Hi Mike, you can check for the major version with
import sys sys.version_info.major On 01.06.2018 04:44, Mike McClain wrote:
OK so I installed python 3.2, which is the latest available as a package in Debian Wheezy, because I've seen so many folks say it's a waste of time to play with Py2.7. Immediately my python playground 'my.python.py' failed as soon as I changes the '#!' line to python3.2. Most of the errors were because I had used 'print' without parens which 2.7 liked but 3.2 doesn't. Is there a way in a script to know which version of python is being run so I can write: If (version == 2.7): do it this way elsif (version == 3.2): do it another way Thanks, Mike -- I Don't care how little your country is, you got a right to run it like you want to. When big nations quit meddling then the world will have peace. - Will Rogers
-- https://mail.python.org/mailman/listinfo/python-list