[EMAIL PROTECTED] writes:
> for line in open("file):
>      print line.
> 
> I want to skip printing last line of the file.thanks

def all_but_last(it):           # yield all but last item of an iterator
   a = it.next()
   for b in it:
      yield a
      a = b

for line in all_but_last(open("file")):
    print line
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to