Learn › Class 12 › Computer Science / Informatics Practices › File handling and data structures (stack)
File handling
Remember
- Modes: r, w (erases), a (appends), + for both, b for binary.
- read(), readline(), readlines(); write(), writelines(); seek() and tell().
- pickle.dump()/load() for binary; csv.writer()/reader() for CSV.
Quick self-check
What is the difference between an absolute and a relative path?
Check
An absolute path starts from the drive or root; a relative path starts from the current folder.
What does f.seek(0) do?
Check
It moves the file position back to the start.