From: Oti <oh...@ya...> - 2002-04-04 20:56:42
|
[ Dylan Browne ] > Is there any simple way to find the size of a file in Python. I get > my file > by calling: > > f = open('myfile','r') > > I then want to determine wither the size in bytes, or the number of > lines in > the file. Normally I would use f.length(), but as it is a pyfile I am > a bit > stuck. Hello Dylan, not a big help, but one concerning the number of lines: [huohead|pwe] > jython Jython 2.1 on java1.3.0 (JIT: null) Type "copyright", "credits" or "license" for more information. >>> f = open("e:/temp/joined.html", "r") >>> lines = f.readlines() >>> len(lines) 149 >>> __________________________________________________ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ |