Home >>Python File Methods

Python File Methods

Python File Methods

Python provides set of inbuilt function for creating, Opening,writing and reading files.

Method Description
close() It is used to close the file.
fileno() It is used to return a number that represents the stream from the operating system's perspective.
flush() It is used to flush the internal buffer.
isatty() It is used to return whether the file stream is interactive or not.
read() It is used to return the file content.
readable() It is used to return whether the file stream can be read or not.
readline() It is used to return one line from the file.
readlines() It is used to return a list of lines from the file.
seek() It is used to change the file position.
seekable() It is used to return whether the file allows us to change the file position.
tell() It is used to return the current file position.
truncate() It is used to resize the file to a specified size.
writeable() It is used to return whether the file can be written to or not.
write() It is used to write the specified string to the file.
writelines() It is used to write a list of strings to the file.

Learn more about Python Files Python Files


Python File Methods Index

Sr.No. Topics
1 Python File close() Method
2 Python File fileno() Method
3 Python File flush() Method
4 Python File isatty() Method
5 Python File read() Method
6 Python File readable() Method
7 Python File readline() Method
8 Python File readlines() Method
9 Python File seek() Method
10 Python File seekable() Method
11 Python File tell() Method
12 Python File truncate() Method
13 Python File writable() Method
14 Python File write() Method
15 Python File writelines() Method

No Sidebar ads