'how to input file path when writing to a file?

I am using windows 10 so I use '\' for current folder. below 'input' is a folder name under current folder. The file will be written under input subfolder of current folder.

can anyone help me find why the below is not working? Thank you!


---> 37         a_file = open('..\\input\\'+'df_timedata_dict_'+area.lower()+'.pkl', "wb")
     38         pickle.dump(df_timedata_dict, a_file)
     39         a_file.close()

FileNotFoundError: [Errno 2] No such file or directory: '..\\input\\df_timedata_dict_prea1.pkl'


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source