I use Jupyter Notebooks on daily basis as a data scientist. I tend to use the same folders for original data, output files, graphics and so on. I usually use it the following way:
import os
import pandas as pd
# paths
data_path = '/foo/bar/data'
output_path = '/foo/bar/output'
# load data
df = pd.read_csv(os.path.join(data_path,'data.csv'))
# do some things with the data
df.to_csv(os.path.join.(output_path, 'mydata.csv'))
However, the paths are always the same. Hence, I copy the same paths in almost every notebook I use. My idea is to store the paths as a txt- or csv-file and to load and read the paths somehow. Is that possible? And if so, how?
EDIT: I tried to read the paths in from a file line by line. That works. But I get thrown the error No file in directory /foo/bar/data
afterwards. Copying the exact same path and using it as described above works.