On Jun 24, 11:00 pm, Peter Otten <__pete...@web.de> wrote: > Private Private wrote: > > > lines = fileinput.input(filename) > > > for line in lines: > > > if "Data2" in line: > > > print line.strip(), "-->", next(lines).strip() > > > I get an error: > > > ... > > print line.strip(), "-->", next(lines).strip() > > NameError: global name 'next' is not defined > > In Python versions prior to 2.6 instead of > > next(lines) > > you can use > > lines.next() > > Peter
That works perfectly. Thank you :-) -- http://mail.python.org/mailman/listinfo/python-list