John Machin wrote:
On Jun 10, 9:01 pm, dmitrey <dmitrey.kros...@scipy.org> wrote:
hi all,
what is easiest way to check python version (to obtain values like
2.4, 2.5, 2.6, 3.0 etc) from Python env?
...
"easiest" depends on purpose; e.g. version for display or for logging
exactly what the customer is running. version_info (or a prefix of it)
is the best for things like conditional imports etc
E.g.
py_version = sys.version_info[:2]
if py_version == (2, 3):
from sets import Set as set
Note also that the definition of tuple comparison help you here:
if (2, 1, 1) < sys.version_info < (2, 3):
...
elif (2, 5) <= sys.version_info <= (2, 6, 2, 'final'):
...
else:
print('Untested')
--Scott David Daniels
scott.dani...@acm.org
--
http://mail.python.org/mailman/listinfo/python-list