Use os.path.getsize function
import os
# Specify the path to the file
file_path = '/path/to/your/file.txt'
# Get the size of the file in bytes
file_size = os.path.getsize(file_path)
print(f'The size of the file is: {file_size} bytes')
Use os.path.getsize function
import os
# Specify the path to the file
file_path = '/path/to/your/file.txt'
# Get the size of the file in bytes
file_size = os.path.getsize(file_path)
print(f'The size of the file is: {file_size} bytes')