Obtaining Python version
Xavier Ho
contact at xavierho.com
Tue Aug 4 07:34:44 EDT 2009
On Tue, Aug 4, 2009 at 8:30 PM, Yinon Ehrlich <yinon.me at gmail.com> wrote:
> Hi,
> Easy way to test for Python version:
> if sys.hexversion >= 0x2060100:
> pass
>
Great suggestion. I just tested it on my newly installed Python 3.1 (as of
3.1r31)
>>> import sys
>>> "%X" % sys.hexversion
'30100F0'
That's genius - '301' for Python 3.1, and '00F0' is r31!
I'm definitely going to use this more often in the future.
Cheers,
Xavier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090804/6ac52a24/attachment-0001.html>
More information about the Python-list
mailing list