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

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

by Srinivas Ramakrishna4mOctober 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.

Company Mentioned

Mention Thumbnail
featured image - Python Tutorial: 4 Methods to Getting the File Size in Python
Srinivas Ramakrishna HackerNoon profile picture
Srinivas Ramakrishna

Srinivas Ramakrishna

@itsmycode

Solution Architect having 14+ Years of Experience in .NET Core, Python, Node.JS, JavaScript, Cloud (Azure), RDBMS

About @itsmycode
LEARN MORE ABOUT @ITSMYCODE'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

Srinivas Ramakrishna HackerNoon profile picture
Srinivas Ramakrishna@itsmycode
Solution Architect having 14+ Years of Experience in .NET Core, Python, Node.JS, JavaScript, Cloud (Azure), RDBMS

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
Also published here
Newsbreak
Coffee-web
Cyberfishnews