[Tutor] How to print the version of Python?

Rob Andrews rob@jam.rr.com
Thu, 17 May 2001 17:18:29 -0500


Thanks. I just downloaded the .tgz of Python 2.1 to install on my linux box. 
I tried upgrading from the 1.5.2 that came installed on the system using the 
RPM, but ran into a slew of dependency issues.

I'm now trying to figure out how to take it from here. (I've already opened 
the .tgz, which usually trips me for some reason.)

Rob

On Thursday 17 May 2001 05:09 pm, Michael P. Reilly wrote:
> 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