← Go Back
Note that
How to Get File Size
The modern, object-oriented approach is using thepathlib
standard module:>>> import pathlib
>>> p = pathlib.Path("C:/python312/python.exe")
>>> p.stat().st_size
103192
Note that
st_size
is expressed in bytes.🐍 You might also find interesting: