Checking Python version in a program

Preston Landers prestonlanders at my-deja.com
Thu Mar 2 13:47:27 EST 2000


Very clever, Fredrik.  This is what I was looking for.  I wasn't aware
you could evaluate lists like that.

thanks,
---Preston

In article <jVxv4.116$fsi.186942464 at newsb.telia.net>,
  "Fredrik Lundh" <effbot at telia.com> 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"
--
|| Preston Landers <prestonlanders at my-deja.com> ||


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list