Chapter 10 · Part I: Basics
Files and Exceptions
Book: Ch. 10, 'Files and Exceptions', pp. 183–208
Pages this chapter covers
- Reading from a Filep. 184
- Reading the Contents of a Filep. 184
- Relative and Absolute File Pathsp. 186
- Accessing a File’s Linesp. 186
- Working with a File’s Contentsp. 187
- Large Files: One Million Digitsp. 188
- Is Your Birthday Contained in Pi?p. 189
- Writing to a Filep. 190
- Writing a Single Linep. 190
- Writing Multiple Linesp. 191
- Exceptionsp. 192
- Handling the ZeroDivisionError Exceptionp. 192
- Using try-except Blocksp. 193
- Using Exceptions to Prevent Crashesp. 193
- The else Blockp. 194
- Handling the FileNotFoundError Exceptionp. 195
- Analyzing Textp. 196
- Working with Multiple Filesp. 197
- Failing Silentlyp. 198
- Deciding Which Errors to Reportp. 199
- Storing Datap. 201
- Using json.dumps() and json.loads()p. 201
- Saving and Reading User-Generated Datap. 202
- Refactoringp. 204
- Summaryp. 207
Notes
Notes are not written yet
The section list above is only a map of the book, with printed page numbers, so you can read the chapter and come back. Original notes for this chapter are still to come.
No exercise yet
An original, auto-checked exercise for this chapter is not in this version.
No quiz yet
A proficiency quiz for this chapter is not in this version.