Text File
- A text file is a file that contains data in the form of characters .
- Each character is stored as an ASCII code or a Unicode code in the file. So, while opening a text file, the text editor translates each ASCII value and shows us the equivalent character that is readable by the human being.
- A text file can be created and edited using a text editor, such as Notepad or WordPad .
- A text file can have different extensions, such as “.txt”, “.csv”, “.py”, etc., depending on the format or content of the file.
- Each line of a text file is terminated by a special character, called the End of Line (EOL).
- Contents in a text file are usually separated by whitespace, but comma (,) and tab (\t) are also commonly used to separate values in a text file.
Binary File
- A binary file is a file that contains data in the form of bytes. Each byte is stored as a sequence of 8 bits (0s and 1s) in the file.
- A binary file can store any type of data, such as images, audio, video, executable code, etc.
- A binary file cannot be created or edited using a text editor, but requires a specific program or application that can understand its format.
- A binary file can have different extensions, such as “.bmp”, “.mp3”, “.exe” , etc., depending on the format or content of the file.
CSV File
- CSV stands for Comma Separated Values.
- A CSV file is a plain text file that stores data in the form of a table , where each row is a record and each column is a field.
- The data entries in each row are separated by commas , hence the name of the format.
- CSV files are often used to store and exchange data between different applications that can handle tabular data, such as spreadsheets, databases, contact managers, etc.
- A CSV file can be opened and edited using a text editor or a spreadsheet program, such as Excel or Google Sheets.
- The extension of CSV files is usually “.csv” . However, some programs or systems may use different extensions for CSV files, such as “.txt”, “.tsv”, “.dat”, etc.