Home >>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