skip last line in loops

stdazi stdazi at gmail.com
Sun Dec 17 06:18:13 EST 2006


lines = open('blah').readlines()
for i in range(0, len(lines)-1) :
   print lines[i]

eight02645999 at yahoo.com wrote:
> hi,
> how can i skip printing the last line using loops (for /while)
>
> eg
>
> for line in open("file):
>      print line.
> 
> I want to skip printing last line of the file.thanks




More information about the Python-list mailing list