04-08-2009 o 00:19:22 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] 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"?
Why not to use: sys.version_info "A tuple containing the five components of the version number: major, minor, micro, releaselevel, and serial. All values except releaselevel are integers; the release level is 'alpha', 'beta', 'candidate', or 'final'. The version_info value corresponding to the Python version 2.0 is (2, 0, 0, 'final', 0)." http://docs.python.org/library/sys.html#sys.version_info Cheers, *j -- Jan Kaliszewski (zuo) <z...@chopin.edu.pl> -- http://mail.python.org/mailman/listinfo/python-list