Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

size of a file or a pcikled object

Status
Not open for further replies.

shussai2

Programmer
Aug 28, 2003
42
0
0
CA
Hi,

I want to calculate the size of a file or a pickled object. So say if a file is 2Kb (displayed in Windows file explorer) then I want the same information be displayed in python too.

reasonfile = open('test.csv', 'r')
#----I don't know the command to calculate size of a file--
print "File size is ", filesize

PLUS

Is there any way I can calculate the size of a pickled object.

>>> pickleddictionary = cPickle.dumps(dictionary)
>>> pickleddictionary
"(dp1\nS'w'\nS'1'\ns."
#---Don't know the code to calculate size--------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top