0

Files

Hey so I cant wrap my head around how to start a file, type it, and then read it. I've been using the python shell (3.6) to try this. Is this wrong to do?

24th Aug 2017, 12:54 AM
Justin Cox
Justin Cox  - avatar
3 Respostas
+ 12
file=open("thing.txt", 'w') file.write("whatever you want") file.close() file=open("thing.txt", 'r') stuff=file.read() file.close() print(stuff) #this should work in idle
24th Aug 2017, 3:37 AM
Ahri Fox
Ahri Fox - avatar
+ 8
Is it possible to get a code snippet of what you have written so we can inspect where you are stuck?
24th Aug 2017, 1:00 AM
Hatsy Rei
Hatsy Rei - avatar
0
It's the Idle form of the program I'm using.
24th Aug 2017, 12:56 AM
Justin Cox
Justin Cox  - avatar