Computer Science 1026A/B Lecture Notes - Lecture 7: Exception Handling, Delimiter, Error Detection And Correction

57 views17 pages
terubarenuka and 39895 others unlocked
COMPSCI 1026A/B Full Course Notes
26
COMPSCI 1026A/B Full Course Notes
Verified Note
26 documents

Document Summary

: text files are commonly used to store information, they are the most portable" type of data. : examples of text files are files that are created with a simple text editor, such as windows. Notepad, and python source code and html files. :to access a file we must first open it! : to open a text file for reading, in the same directory as the program: use filename and r as arguments for the open () function . : use w to open a file for writing. If the file does not exist, an empty file is created. :when you are done processing a file, be sure to close the file using the close() method: infile. close() outfile. close() : if your program exits without closing a file that was opened for writing, some of the output may not be written to the disk file.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents

Related Questions