Skip to content
masterclass Buddy

Python · Function

open

open() opens a path or file descriptor and returns a file object. Its mode chooses reading, writing, appending, text, binary, or update behavior.

Last updated

Syntax

open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • io
  • os
  • os.path
  • tempfile
  • shutil
  • read
  • write

Source: Built-in functions — Python 3.15.2 documentation. Checked 2026-11-03.