Help opening files | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help opening files

Hello everyone, For some reason I'm really struggling with opening files in Python. I have tried examples such as these: 1) With open('Practice/words.txt,) (Both with / and \) 2) With open('words.txt') And other similar examples, but I always receive the error: [Errno 2] No such file or directory: And when I include the full path to the file I receive: (unicode error) 'unicodescape' codec can't decode bytes in position 2-3: Truncated \UIXXXXXXXX escape Sincerely, Adrian

6th Feb 2018, 3:42 AM
Adrian Tippit
Adrian Tippit - avatar
2 Answers
+ 1
Thank you Jan, I'll try this the next time I'm at my computer. I think the \\ might be my problem. Thanks again! Sincerely, Adrian
6th Feb 2018, 4:54 AM
Adrian Tippit
Adrian Tippit - avatar
+ 1
Hey Jan, I couldn't get the file to open from a different directory, but when I move the file to the same location as my script it worked. I'll try to figure out what's wrong with opening it from a different location some other time since I need to get some more studying done. Thank you again for your help! Sincerely, Adrian
6th Feb 2018, 5:46 AM
Adrian Tippit
Adrian Tippit - avatar