On 3/30/06, *Sullivan Zheng* <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
>
> Wow, seems I am not that supid. Why python does not include this
> function in the file object. It is almost a tradition in other
> languages...
>
> import os
>
> os.stat(path).st_size
>
> really not elegant or OO.
You might find something like Jason Orendorff's path.py module (Google
for it) to be more elegant. With it, this works fine:
>>> from path import path
>>> path('foobar').getsize()
12345L
(But note that it's just a nice wrapper around the scattered builtin
ways of doing the same thing, in this case the os.stat().st_size
approach mentioned above. That's not a bad thing, though, IMHO.)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list