0

Opening files(.txt) on python.

So I started the "opening file" lesson on python core. Even though my .py and .txt files were in the same directory it didn't read it. I also tried navigating the directories using "c:/Users/tosin/Documents/email.txt" it still didn't work. Am I missing something?

15th Jul 2022, 9:34 AM
Adekunle Oluwatosin Habeeb
Adekunle Oluwatosin Habeeb - avatar
4 odpowiedzi
+ 3
Please link your code.
15th Jul 2022, 9:35 AM
Lisa
Lisa - avatar
+ 2
You only open the file, you are not reading anything from it. Have another look at the lessons: You need to open the file, read its content and close it again. https://www.tutorialspoint.com/how-to-read-a-text-file-in-JUMP_LINK__&&__python__&&__JUMP_LINK
15th Jul 2022, 10:26 AM
Lisa
Lisa - avatar
0
https://code.sololearn.com/cjo8hxlRuEEZ/?ref=app
15th Jul 2022, 9:40 AM
Adekunle Oluwatosin Habeeb
Adekunle Oluwatosin Habeeb - avatar
0
Thanks Lisa, you're a gem. I finally got it to work.
15th Jul 2022, 12:23 PM
Adekunle Oluwatosin Habeeb
Adekunle Oluwatosin Habeeb - avatar