November 2001
Beginner
320 pages
5h 53m
English
The basic processes of opening a file have already been covered in Chapters 4 and 8. Once the file has been opened you end up with a file object which is then used to access the information from the file. The methods supported by a file object closely mimic the functions and operators we would normally use in Perl and other oddities, such as using line based input (as opposed to free-form or byte based input) are supported natively by the file object.
The basic Perl functions and equivalent Python file methods are listed in Table 11.1. We'll have a look at the specifics of reading, writing, and locating our position within a file in this section.
| Perl operation | Python equivalent ... |
|---|