+ 1
Nothing happens when I try to read a file
I created a txt file called filename in the same directory with the python file that I'm working on but when I run the program, nothing really shows up file = open("filename.txt", "r") cont = file.read() print(cont) file.close()
5 Antworten
+ 2
I know you might have done the below step:
The txt file should have something in it. Something like abcd or any text
+ 1
Steve Sajeev
ohhh silly me
+ 1
Did you do this in sololearn or your pc's ide
+ 1
on PC, actually sololearn doesn't provide TRY IT YOURSELF for this session for some reason
but thanks man it works now
i remember writing something in it except I didn't save the txt, just a minor prob