```
def compareVersion(self, version1, version2):
"""
:type version1: str
:type version2: str
:rtype: int
"""
v1str = version1.split('.')
v2str = version2.split('.')
count1 = len(v1str)
count2 = len(v2str)
count = max (count1, count2)
for i in xrange(count):
if i < count1 and i < count2:
if int(v1str[i]) > int(v2str[i]):
return 1
elif int(v1str[i]) < int(v2str[i]):
return -1
else:
if i+1 == count1 and i+1 == count2:
return 0
else:
continue;
if i < count1:
if int(v1str[i]) == 0:
continue
else:
return 1
if i < count2:
if int(v2str[i]) == 0:
continue
else:
return -1
return 0
```