I have a directory as follows:
my_dir
|__data
| |
| light_colors.csv
|__code
|__data_reader.py
I would like to create a directory in data directory, where i can save the output of the data_reader.py file.
output :
my_dir
|__data
| |__processed
| | |__light_colors_processed.csv
| |
| light_colors.csv
|__code
|__data_reader.py
I know how to do that if the data directory was in the same directory as the code directory, but do not know how to get the data from another directory. if the data was in the 'code' directory I would do the following:
tobeparsed.save_file('data/processed/' + file_to_be_parsed.split('.')[0] + _processed.csv')
return tobeparsed
if __name__ == '__main__':
if 'processed' not in os.listdir('data/'):
os.mkdir('data//processed')
parsing('data/light_colors.csv')