Checking Python version in a program
Mikael Olofsson
mikael at isy.liu.se
Fri Mar 3 02:44:56 EST 2000
On 02-Mar-00 Fredrik Lundh wrote:
> note that [1, 5, 2] < [1, 6]. in other words,
> this will do what you want:
>
> import string, sys
>
> version = string.split(string.split(sys.version)[0], ".")
>
> if map(int, version) < [1, 5, 2]:
> print "sorry"
Fredrik,
Has anyone told you that you are a goldmine?
I've seen this sevaral times. Someone has a problem, in this case
Preston. He comes up with a solution that almost works and that
requires several lines of code. Then you jump in and lo, there is
a beautiful two or three line solution.
what-would-we-do-without-you-ly y'rs
/Mikael
-----------------------------------------------------------------------
E-Mail: Mikael Olofsson <mikael at isy.liu.se>
WWW: http://www.dtr.isy.liu.se/dtr/staff/mikael
Phone: +46 - (0)13 - 28 1343
Telefax: +46 - (0)13 - 28 1339
Date: 03-Mar-00
Time: 08:37:49
This message was sent by XF-Mail.
-----------------------------------------------------------------------
More information about the Python-list
mailing list