File: pyedit-products/unzipped/docetc/examples/RunCode-examples/python2.X-test.py

# set your python executable in textConfig.py to a Python 2.X
# installed executable, start Pyedit, and open and run this file

# Python 2.X code generally works in the 3.X Pyedit, including
# any "from __future__ import X" statements; this means your code
# can choose to use either Python 3.X or 2.X prints as usual;

#from __future__ import print_function    # <= for 3.X prints

import sys
print sys.version
print raw_input

reps = raw_input('reps? ')         # versus input in 3.X
for i in range(int(reps)):
    print(i, '*' * (i+1))          # it's a tuple in 2.X!



[Home page] Books Code Blog Python Author Training Search ©M.Lutz