+ 1

How to calculate file size in python?

while we write a coding in embedded by using python how to calculate the file size.

30th May 2018, 4:46 AM
SATHISHKUMAR V
SATHISHKUMAR V - avatar
5 Answers
+ 3
youll need access to the file itself UseĀ os.stat, and use theĀ st_sizeĀ member of the resulting object: >>> import os >>> statinfo = os.stat('somefile.txt') >>> statinfo (33188, 422511L, 769L, 1, 1032, 100, 926L, 1105022698,1105022732, 1105022732) >>> statinfo.st_size 926L Output is in bytes. https://stackoverflow.com/questions/2104080/how-to-check-file-size-in-JUMP_LINK__&&__python__&&__JUMP_LINK
30th May 2018, 4:54 AM
į Œį ŒCode X
į Œį ŒCode X - avatar
+ 4
SATHISHKUMAR.V by the way you can check your file size when you open it in your desktop It will be next to it
30th May 2018, 4:56 AM
šŸ‘‘ Prometheus šŸ‡øšŸ‡¬
šŸ‘‘ Prometheus šŸ‡øšŸ‡¬ - avatar
+ 3
Depends on the number of 0s and 1s used to store your code in your C drive, etc. :/
30th May 2018, 4:55 AM
šŸ‘‘ Prometheus šŸ‡øšŸ‡¬
šŸ‘‘ Prometheus šŸ‡øšŸ‡¬ - avatar
+ 1
Thanks Brains let me try and come back to you
30th May 2018, 5:17 AM
SATHISHKUMAR V
SATHISHKUMAR V - avatar
- 1
Pegasus thank you. I know that but without desktop option how can we know the file size?
30th May 2018, 5:16 AM
SATHISHKUMAR V
SATHISHKUMAR V - avatar