Name

file, open

Synopsis

file(path,mode='r',bufsize=-1)
open(filename,mode='r',bufsize=-1)

Opens or creates a file and returns a new file object. In Python 2.2 and later, open is a synonym for the built-in type file. In Python 2.1 and earlier, open was a built-in function and file was not a built-in name at all. See Section 10.3.

Get Python in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.