General Notes
File Handling
- Text files consist of lines of text that are read or written consecutively as strings
- The purpose of storing data in a file is to be used again by a program
- Data in files are stored permanently, meaning they can be used later
- It is good practice to explicitly open a file, stating the mode of operation, before reading from or writing to it.
- File can be opened in three modes:
- READ: for data to be read from the file
- WRITE: for data to be written to the file. A new file will be created and any existing data in the file will be lost
- APPEND: for data to be added to the file, after any existing data
- A file should be opened in only one mode at a time
PYTHON
Python can be executed directly in the browser.
Editor — Python
Output
No output yet.
