The open() function

This function is used to open a file and does not require any external module to be imported.

The syntax is as follows:

            Name_of_file_object = open("Name of file","Access_Mode")

For the preceding syntax, the file must be in the same directory that our Python program resides in. If the file is not in the same directory, then we also have to define the file path while opening the file. The syntax for such a condition is shown here:

Name_of_file_object = open("/home/……/Name of file","Access_Mode")
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset