number of lines in a file
Mark McEahern
marklists at mceahern.com
Fri Mar 29 09:55:13 EST 2002
f = open(filename)
lines = f.readlines()
f.close()
print "%s has %d lines." % (filename, len(lines))
// mark
-----Original Message-----
From: python-list-admin at python.org [mailto:python-list-admin at python.org]On
Behalf Of Joseph Youssef
Sent: Thursday, March 28, 2002 9:26 PM
To: python-list at python.org
Subject: number of lines in a file
hello, I am nwe to Python and I'm trying to write this script but I need it
to check how many lines is in the file and I don't know how so I'm hoping
someone could tell me.
--
Too often we lose sight of life's simple pleasures. Remember when someone
annoys you it takes 42 muscles in your face to frown, BUT, it only takes 4
muscles to extend your arm and bitch-slap that mother@#?!&! upside the head!
More information about the Python-list
mailing list