In this article, we will discuss a memory-efficient solution to read the last line or last N lines from a text or CSV file in python. Then we will also see how to real only last line or check if the last line in the file matches the given line.
In this article, we will discuss how to append a row to an existing csv file using csv module’s reader / writer & DictReader / DictWriter classes.
In this article we will discuss how to add a column to an existing CSV file using csv.reader and csv.DictWriter classes. A part from appending the columns we will also discuss how to insert columns in between other columns of the existing CSV file.
In this article, we will discuss different ways to delete specific lines from a file either by line number, by matching content or based on any custom logic.
In this article, we will discuss different ways to get file size in human-readable formats like Bytes, Kilobytes (KB), MegaBytes (MB), GigaBytes(GB) etc.
In this article, we will discuss different ways to check if a file is empty i.e. its size is 0 using os.stat() or os.path.getsize() or by reading its first character.
In this article, we are going to discuss, how to search for single or multiple strings in a file and get all the matched lines along with their line numbers.
In this article, we will discuss how to append text or new lines to an existing file using python.
In this article, we will discuss how to use “open with” statement to open a file and what are its benefits. Also, how to open multiple files in a single “open with” statement.
In this article we will discuss how to create a zip archive from selected files or files from a directory based on filters.