Simple file line reading
Jeroen Wenting
beefjerky at hornet.beefjerky.demon.nl
Fri Mar 12 14:51:53 EST 2004
"Aaron Deskins" <ndeskins at ecn.purdue.edu> wrote in message
news:40520BD5.9090006 at ecn.purdue.edu...
> Hello everyone,
> I'm relatively new to Python and am trying to write some scripts.
me too :) Started last weekend reading seriously
>
> import string
> it = 0
> for line in open("OUTCAR"):
> it+=1
> print it
>
f = open("OUTCAR")
print(len(f.readlines()))
f.close()
will print the number of lines in the file (I think :) might have made a
typo or something).
--
Jeroen Wenting
jwenting at hornet dot demon dot nl
More information about the Python-list
mailing list