[Tutor] regex to promote Py 2 to Py 3?

Jim Mooney cybervigilante at gmail.com
Wed Apr 17 07:11:33 CEST 2013


> Generally the 2to3 script does an OK job. If you're using Windows it's
> [Python_Dir]\Tools\Scripts\2to3.py.
>
> http://docs.python.org/3/library/2to3
================================

Thanks. I didn't know where to find it and thought I had to install it.

I opened a command window in my Python33/progs dir, started Python,
and ran it on a tiny test program called loops.py but I get "invalid
syntax" Any idea why?:

>>> 2to3 loops.py
  File "<stdin>", line 1
    2to3 loops.py
       ^
SyntaxError: invalid syntax

The loops.py program simply had the old-style print as a single test
statement. ie:

print 'Machiavelli'

Jim


More information about the Tutor mailing list