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

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to