On 25 Mar 2005 07:34:38 -0800, Keith <[EMAIL PROTECTED]> wrote: > Is there a function for comparing version numbers? > > E.g. > > 0.1.0 < 0.1.2 > 1.876b < 1.876c > 3.2.2 < 3.4 >
Not by default AFAIK. How about something like (untested): def test_version(v1, v2): v1, v2 = v1.split('.'), v2.split('.') for x, y in zip(v1, v2): if x < y: return v1 if y > x: return v2 It assumes that v1 and v2 have the same amount of '.'s and that all of the version numbers are of the same length (i.e. 1.1000 would be < 1.999). How general do you need to be? Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list