A file is a named location on a disk drive that is used to store data. Each file is identified by its filename. Python contains inbuilt functions for reading data from files, as well as creating and writing to files.
There are two types of files. Text files and binary files. By default Python reads and writes data in a text file.
A text file stores sequences of characters. Plain text files, HTML files, program source code.
Use these file modes when opening a file in text mode:
A binary file is stored in the same format as the computer’s memory (RAM). Any images such as jpeg, audio, or program executable files
Use these file modes when opening a file in binary mode: