I am writing a program where you have to extract bits of text from a text file. The specific bit of text is the save directory where I would like to save the files produced by my program. Here is my code:
file = open("datafile.txt", "r")
SaveDir = file.read()
print SaveDir
That seems to be working properly, the output is exactly as it should be, "/home/marc/QuickJotProgram/QuickJotTexts "
Please note that the program skips a line before the end quote which is my problem
It's not a problem until later in the program where I use the SaveDir variable:
text_file = open(os.path.join(SaveDir, title), "w")
The error message is:
text_file = open(os.path.join(SaveDir, title), "w")
IOError: [Errno 2] No such file or directory: '/home/marc/QuickJotProgram/QuickJotTexts\n/file'
The only thing that should not be there is the "\n" I just need to get rid of that, and the program will run smoothly.
Thanks ubuntu :)