I'm trying to take the input file and save it into a new folder on my computer, but I can't figure out how to do it correctly.
Here is the code I tried:
from os.path import join as pjoin
a = raw_input("File Name: ")
filepath = "C:\Documents and Settings\User\My Documents\'a'"
fout = open(filepath, "w")
path_to_file = pjoin("C:\Documents and Settings User\My Documents\Dropbox",'a')
FILE = open(path_to_file, "w")
When I run it, it's putting two \ in between each sub-directory instead of one and it's telling me it's not an existing file or directory.
I am sure there is an easier way to do this, please help.
rand then you don't have to do this. i.e. either"C:\\Documents and Settings\\User\\My Documents"orr"C:\Documents and Settings\User\My Documents". Also you need to usepjoin()to concatenate the directory name toafor both the input and output files youopen(), and one of them should be opened for reading and the other for writing.FILEso as not to shadow the builtin, just note that accepted convention for that is a single trailing underscore ie.file_, all caps are used for constants usually