This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: ) dataout.write(Some text \ n) dataout.write(that is written to a file \ n) dataout.close() (See writing_file.py for explanation about the above statements.) Test the code in Figure 7.3 in the Study Guide (Page 149) 3 Writing to files We can also read data from an existing file: datain = file(sample.txt, r) (or: datain = open(sample.txt, r) ) data = datain.read() # read() returns entire file as a string print(data) datain.close() Test the above code 4 Reading from files...
View Full Document
- Spring '08