Hello,
I am 64 years old but new to Python and brand new to this forum. If I due something wrong please let me know.
I purchased a book on python and I'm working through it. I am trying to work on opening/reading/writing to files. I just cannot open a file in another directory from my python script location. I have followed every direction and googled until my fingers are bleeding. I am obviously missing something.
My computer is Windows 10
My python file is saved in Dropbox (I sometimes study from different locations)
Here is my code:
I keep getting the error:
I apologize for asking about something this simple but I am just so frustrated. Any help you can offer would be very appreciated.
Thanks,
Don
I am 64 years old but new to Python and brand new to this forum. If I due something wrong please let me know.
I purchased a book on python and I'm working through it. I am trying to work on opening/reading/writing to files. I just cannot open a file in another directory from my python script location. I have followed every direction and googled until my fingers are bleeding. I am obviously missing something.
My computer is Windows 10
My python file is saved in Dropbox (I sometimes study from different locations)
Here is my code:
1 2 3 4 5 6 7 8 9 10 |
import csv import os path = "This PC/Windows(C:)/Users/dcw99/Documents/Python_basics_work_files/python-basics-exercises-master" \ "/ch11-file-input-and-output/practice_files/" with open (os.path.join(path, "wonka.csv" ), "r" ) as my_file: reader = csv.reader(my_file) for row in reader: print (row) |
I keep getting the error:
Error:OSerror: [error22] Invalid Argument:"This PC/Windows(C:)/Users/dcw99/Documents/Python_basics_work_files/python-basics-exercises-master" \
"/ch11-file-input-and-output/practice_files/wonka.csv"
I have typed the path exactly as it appears. I've placed an r immediately in front of the path, as instructed. No joy.I apologize for asking about something this simple but I am just so frustrated. Any help you can offer would be very appreciated.
Thanks,
Don