Tamaño del archivo de Python
>>> import os
>>> b = os.path.getsize("/path/isa_005.mp3")
>>> b
2071611
DigitalBorder
>>> import os
>>> b = os.path.getsize("/path/isa_005.mp3")
>>> b
2071611
import os
# get size in bytes
path = 'path/to/file.txt'
size = os.path.getsize(path)
import os
filepath='file1.txt'
size=os.path.getsize(filepath)
print(str(size) + ' Bytes')
import os
the_file_that_you_Want_to_check_the_size = os.path.getsize("The file Name")
print(the_file_that_you_Want_to_check_the_size)
# Your result #
import os
os.path.getsize('C:\\Python27\\Lib\\genericpath.py')
>>> from pathlib import Path
>>> Path('somefile.txt').stat()
#OUTPUT:
os.stat_result(st_mode=33188, st_ino=6419862, st_dev=16777220, st_nlink=1, st_uid=501, st_gid=20, st_size=1564, st_atime=1584299303, st_mtime=1584299400, st_ctime=1584299400)
>>> Path('somefile.txt').stat().st_size
#OUTPUT:
1564