How to get file size in Python?
Posted on In QAHow to get a file’s size in Python from the full path of a file?
You can use this piece of Python code:
os.path.getsize(file_path)
It returns the size in bytes. It raises os.error
if the file does not exist or is inaccessible.
Manual of os.path.getsize()
: https://docs.python.org/2/library/os.path.html#os.path.getsize