code_junkie

Size of an open file object

Nov 12th, 2011
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. $ ls -la chardet-1.0.1.tgz
  2. -rwxr-xr-x 1 vinko vinko 179218 2008-10-20 17:49 chardet-1.0.1.tgz
  3. $ python
  4. Python 2.5.1 (r251:54863, Jul 31 2008, 22:53:39)
  5. [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
  6. Type "help", "copyright", "credits" or "license" for more information.
  7. >>> f = open('chardet-1.0.1.tgz','rb')
  8. >>> f.seek(0,2)
  9. >>> f.tell()
  10. 179218L
  11.  
  12. >>> import os
  13. >>> os.fstat(f.fileno())[6]
  14. 179218L
  15. >>>
  16.  
  17. current_size = f.tell()
Add Comment
Please, Sign In to add comment