File handling in python syntax | for beginners

#filehandling #pythonsyntax File Handling in Python File handling is an important activity in every web app. The types of activities that you can perform on the opened file are controlled by Access Modes. These describe how the file will be used after it has been opened. These modes also specify where the file handle should be located within the file. Similar to a pointer, a file handle indicates where data should be read or put into the file. In Python, there are six methods or access modes, which are: Read Only (’r’): This mode opens the text files for reading only. The start of the file is where the handle is located. It raises the I/O error if the file does not exist. This is the default mode for opening files as well. Read and Write (’r ’): This method opens the file for both reading and writing. The start of the file is where the handle is located. If the file does not exist, an I/O error gets raised. Write Only (’w’): This mode opens the file for writing
Back to Top