Skip to content

Language

Sign in

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

  1. 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.

  2. What does f.seek(0) do?

    Check

    It moves the file position back to the start.

Reviewed by EduFlint team on 1 Dec 2026 · version 1

Written by us for this site. Independent; not affiliated with NCERT or CBSE.

Report a mistake

Looking for another topic?