Private Private wrote:
On Jun 24, 1:32 pm, Peter Otten <__pete...@web.de> 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

Sorry, I am running 2.6
Try:
    print line.strip(), "-->", lines.next().strip()

--Scott David Daniels
scott.dani...@acm.org
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to