Advertisements
Advertisements
प्रश्न
Write the file mode that will be used for opening the following file. Also, write the Python statement to open the following file:
a text file “example.txt” in both read and write mode
टीपा लिहा
Advertisements
उत्तर
The mode that will be used for opening given file is -
Read and Write (<r+> or <+r>) : This mode is used to open the file for reading and writing. The File Offset is positioned at the beginning of the file. It will raise an I/O error if the file does not exists.
Example - file = open("example.txt","r+")
file.close()shaalaa.com
Types of Files in Python
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
