Advertisements
Advertisements
Question
Write the use and syntax for the following method:
open()
Short/Brief Note
Advertisements
Solution
To open a file in Python, we use the open() function. The syntax of open() is as follows:
file_object = open(file_name, access_mode)
This function returns a file object called file handle which is stored in the variable file_object.
Example: myObject = open(“myfile.txt”, “a+”)
shaalaa.com
Opening and Closing a Text Files in Python
Is there an error in this question or solution?
