< eelmine | Table of Contents | next > |
7.1 WHAT IS A FILE?
Files are used to store data persistently. This means the information in files remains available even after the program that created or modified them has finished running or the computer has been turned off. Files allow us to save our work, share data, and communicate between different programs and systems.
On a high level, we can categorize files into two types - text files and binary files. Text files contain data that is in a human-readable format. They can be opened and edited with a text editor, such as a notepad or a code editor. Examples would be text files .txt
and python scripts .py
.
Binary files contain data in a format that is not intended to be directly readable by humans. This includes images (.jpg
, .png
) and executable files (.exe
on Windows), to name a few. While you can open a binary file in a text editor, the content will appear as a garbled mess of characters because it represents encoded data that only specific software can correctly interpret.
KEY THINGS TO REMEMBER
- Files are used to store data persistently, meaning the information remains available even after the program ends or the computer is turned off.
- Text files contain data in a human-readable format, such as
.txt
and.py
. They can be edited using text editors, such as Notepad. - Binary files contain data that is not in a human-readable format, examples include images
.jpg
and executable files.exe
.
< eelmine | Table of Contents | next > |