[Tutor] How to print the version of Python?
Michael P. Reilly
arcege@speakeasy.net
Thu, 17 May 2001 18:09:58 -0400 (EDT)
Rob Andrews wrote
> I droop my head in shame at having to ask this one, but how can I instruct my
> script to print the version of Python running it?
>>> import sys
>>> print sys.version
1.5.2 (#1, Aug 25 2000, 09:33:37) [GCC 2.96 20000731 (experimental)]
>>>
>>> import sys
>>> print sys.version
2.0 (#3, Dec 18 2000, 02:47:55)
[GCC 2.96 20000731 (Red Hat Linux 7.0)]
>>>
It was once suggested that the first three characters of the version
string is used for the printed release number.
>>> print sys.version[:3]
-Arcege
--
+----------------------------------+-----------------------------------+
| Michael P. Reilly | arcege@speakeasy.net |