Windows 10 show file size in mb

broken image

Let’s use this function to get the size of a file in bytes, Therefore, always check that file exist or not before calling this function.

broken image

If the file doesn’t exist at the given path or it is inaccessible, then it raises an os.error. It accepts the file path as an argument and returns the size of a file at the given path in bytes. In this article, we will discuss different ways to get file size in human-readable formats like Bytes, Kilobytes (KB), MegaBytes (MB), GigaBytes(GB) etc.ĭifferent ways to get file size in Bytes Get file size in bytes using os.path.getsize()