Newbie Needs help!!
Terry Reedy
tjreedy at udel.edu
Fri Oct 10 15:53:23 EDT 2003
More information about the Python-list mailing list
Fri Oct 10 15:53:23 EDT 2003
- Previous message (by thread): Newbie Needs help!!
- Next message (by thread): Newbie Needs help!!
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Rigga" <Rigga at noemail.com> wrote in message news:h9Chb.60$X53.47 at news-binary.blueyonder.co.uk... > Thanks for your reply, I was under the misunderstanding that I could read > the contents of the file and get the total number of lines the file > contains in one go. Any pointers to how I can count the lines manually?? Read the file with lines=readlines() instead of read(). Then len(lines) is your count. If you really must read with all=read(), then count = all.count('\n') + (all[-1] != '\n') Terry J. Reedy
- Previous message (by thread): Newbie Needs help!!
- Next message (by thread): Newbie Needs help!!
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list