Check the File Size with Python

Configurare noua (How To)

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

Solutie

Tip solutie

Permanent

Voteaza

(8 din 14 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?