Explain all the file processing modes supported by Python?
Answers
Answer:
A file is some information or data which is stored (save) in the computer storage devices. Python provides basic functions and methods necessary to manipulate files by default. You can do most of the file manipulation using a file object. Python language supports two types of files. First one is text file that store data in the form of text file and readable by human and computer. Second one is binary file that store binary data and readable by computer only. Python has a built-in function open() to open a file. This function returns a file
Python allows you to open files in one of the three modes. They are:read-only mode, write-only mode, read-write mode, and append mode by specifying the flags “r”, “w”, “rw”, “a” respectively.A text file can be opened in any one of the above said modes by specifying the option “t” along with“r”, “w”, “rw”, and “a”, so that the preceding modes become “rt”, “wt”, “rwt”, and “at”.A binary file can be opened in any one of the above said modes by specifying the option “b” along with “r”, “w”, “rw”, and “a” so that the preceding modes become “rb”, “wb”, “rwb”, “ab”.