File Handling In Python
In Python, a file operation takes place in the following order.
Open a file
Read or write (perform operation)
Close the file
How to open a file?
Python has a built-in function open() to open a file. This function returns a file object, also called a handle, as it is used to read or modify the file accordingly.
f = open("test.txt") # open file in current directory
f = open("C:/Python33/README.txt") # specifying full path
How to close a file Using Python?
How to write to File Using Python?
How to read files in Python?
Tell & Seek
Readline
Last updated
Was this helpful?