On Aug 3, 7:19 pm, John Nagle <na...@animats.com> wrote: > This works, but it seems too cute: > > >>> pyver = map(int,sys.version.split()[0].split('.')) > >>> print(pyver) > [2, 6, 1] >
You can also do: >>> import sys >>> sys.version_info (2, 5, 2, 'final', 0) or >>> sys.version_info[:3] (2, 5, 2) > Is it guaranteed that the Python version string will be in a form > suitable for that? In other words, does "sys.version" begin > > N.N.N other stuff > > in all versions, and will it stay that way? Are there ever > non-numeric versions, like "3.2.rc1"? > > John Nagle I strongly suspect that sys.version_info would never change... André -- http://mail.python.org/mailman/listinfo/python-list