File handling in Python
We can read , write ,append or create file by using file handler object in Python. Here are the methods we will be using for managing files.
destination source:https://www.plus2net.com/python/file.php
File handling in Python
Mode | Details |
---|---|
read() | Reading content of a file |
readable() | Check if file is readable or not |
write() | Write content to file |
seek() | Move the file pointer to different location inside the file |
seekable() | Check if file is seekable or not |
tell() | Get the position of the file pointer |
readlines() | Getting a list from the content of a file |
readline() | Reading line of data from a file |
truncate() | Resize a file upto the input bytes |
writable() | Check if the file is writable or not |
writelines() | Writing list to file |
Related Article
destination source:https://www.plus2net.com/python/file.php