Situatie
Using os module
Using stat()
from the os
module, you can get the details of a file. Use the st_size
attribute of stat()
method to get the file size.
The unit of the file size is byte
.
Backup
import os
file_stat = os.stat('my_file.txt')
print(file_stat.st_size)
Output
34
Leave A Comment?