version

Mike McClain mike.junk.46 at att.net
Thu May 31 22:44:35 EDT 2018


    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



More information about the Python-list mailing list