December 2000
Intermediate to advanced
816 pages
16h 57m
English
As the key to opening file doors, the open() built-in function provides a general interface to initiate the file input/output (I/O) process. open() returns a file object on a successful opening of the file or else results in an error situation. When a failure occurs, Python generates or raises an IOError exception—we will cover errors and exceptions in the next chapter. The basic syntax of the open() built-in function is:
file_object = open(file_name, access_mode='r', buffering=-1)
The file_name is a string containing the name of the file to open. It can be a relative or absolute/full pathname. The access_mode optional variable is also a string, consisting of a set of flags indicating which mode to open ...
Read now
Unlock full access