paint-brush
Python Tutorial: 4 Methods to Getting the File Size in Pythonby@itsmycode
252 reads

Python Tutorial: 4 Methods to Getting the File Size in Python

by Srinivas RamakrishnaOctober 1st, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

OS module in Python comes as built-in, and it provides various utility methods to interact with operating system features. The popular ways to fetch file size in Python are as follows: Get file size using os.path.getsize() and seek(). If the function cannot find the file or is inaccessible, Python will raise an [OSError] If you have something like file-like objects, you could use `seek() and tell() to fetch the file size. The other methods perfectly work in the case of an actual file.
featured image - Python Tutorial: 4 Methods to Getting the File Size in Python
Srinivas Ramakrishna HackerNoon profile picture
Srinivas Ramakrishna

Srinivas Ramakrishna

@itsmycode

L O A D I N G
. . . comments & more!

About Author

Srinivas Ramakrishna HackerNoon profile picture
Srinivas Ramakrishna@itsmycode

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite
Newsbreak
Coffee-web
Cyberfishnews