Colin J. Williams wrote:

> I was seeking some code that would be acceptable to both Python 2.7 and
> 3.3.
> 
> In the end, I used:
> 
> inData= csv.reader(inFile)
> 
> def main():
>      if ver == '2':
>          headerLine= inData.next()
>      else:
>          headerLine= inData.__next__()
>      ...

I think it was mentioned before, but to be explicit:

def main():
    headerLine = next(inData)
    ...

works in Python 2.6, 2.7, and 3.x.

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

Reply via email to