sample_cleaning_demo/filesize.py

10 lines
242 B
Python
Raw Normal View History

2023-05-12 11:20:02 +08:00
# get file size in python
import os
file_name = "Sample/QQ.exe"
file_stats = os.stat(file_name)
print(file_stats)
print(f'File Size in Bytes is {file_stats.st_size}')
print(f'File Size in MegaBytes is {file_stats.st_size / (1024 * 1024)}')