To get the size of a file in Python you can use the following snippet.
You can combine this snippet with How to format bytes to human readable Size in Python.

Sample Python

os.path.getsize(fileName)

One thought on “How to get the size of a file in Python”

Leave a Reply