比较版本号version1(3.2.4.3)和version2(3.2.4.5)

def compareVersion(version1,version2):
    num1=list(map(int,version1.split('.')))
    num2=list(map(int,version2.split('.')))
    l1,l2=len(num1),len(num2)
    for i in range(max(l1,l2)):
        tmp1=num1[i] if i<l1 else 0
        tmp2=num2[i] if i<l2 else 0
        if tmp1!=tmp2:
            return 1 if tmp1>tmp2 else -1
    return 0