Home >>Python Built-in Functions >Python open() Function
Python open() function is used to open a given input file and return the given file as a file object.
Syntax:open(file, mode)
Parameter | Description |
---|---|
file | This parameter defines the path and name of the file. |
mode | This parameter holds a string which defines mode you want to open the file in. |
f = open("pythondemo.txt", "r")
print(f.read())