Categories
Python Examples

Python Program to Check the File Size

In this example, you will learn to check the file size. Example 1: Using os module import os file_stat = […]

Categories
Python Examples

Python Program to Get the Full Path of the Current Working Directory

In this example, you will learn to get the full path of the current working directory. Example 1: Using pathlib […]

Categories
Python Examples

Python Program to Get File Creation and Modification Date

In this example, you will learn to get file creation and modification date. Example 1: Using os module import os.path, […]

Categories
Python Examples

Python Program to Find All File with .txt Extension Present Inside a Directory

In this example, you will learn to find all files with .txt extension present inside a directory. Example 1: Using […]

Categories
Python Examples

Python Program to Get Line Count of a File

In this example, you will learn to get line count of a file. Example 1: Using a for loop The […]

Categories
Python Examples

Python Program to Get the File Name From the File Path

In this example, you will learn to get the file name from the file path. Example 1: Using os module […]

Categories
Python Examples

Python Program to Extract Extension From the File Name

In this example, you will learn to extract extension from the file name. Example 1: Using splitext() method from os […]

Categories
Python Examples

Python Program to Append to a File

In this example, you will learn to append to a file. Open file in append mode and write to it […]

Categories
Python Examples

Python Program Read a File Line by Line Into a List

In this example, you will learn to read a file line by line into a list. Example 1: Using readlines() […]

Categories
Python Examples

Python Program to Copy a File

In this example, you will learn to copy the content of a file to another file using Python. Using shutil […]