2to3 on degree2decimal.py
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Thu, 28 Nov 2019 10:22:30 +0000 (11:22 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Thu, 28 Nov 2019 10:22:30 +0000 (11:22 +0100)
googlemap/degree2decimal.py

index 6cc2211..071879b 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
 # transforms a degree notation like
 # 43:36:56.32 (43 degrees 36 minutes 56.32 seconds) 
 # into a decimal notation
 # transforms a degree notation like
 # 43:36:56.32 (43 degrees 36 minutes 56.32 seconds) 
 # into a decimal notation
@@ -14,14 +14,14 @@ second=1./3600
 def translate (coord):
     r=matcher.match(coord)
     if not r:
 def translate (coord):
     r=matcher.match(coord)
     if not r:
-        print 'failed to parse',coord,'pattern=',pattern
+        print('failed to parse',coord,'pattern=',pattern)
     else:
     else:
-        (deg,min,sec)=map(float,r.groups())
+        (deg,min,sec)=list(map(float,r.groups()))
 #        print 'deg',deg,'min',min,'sec',sec
         if (deg>0):
 #        print 'deg',deg,'min',min,'sec',sec
         if (deg>0):
-            print coord,'->',deg+min*minute+sec*second
+            print(coord,'->',deg+min*minute+sec*second)
         else:
         else:
-            print coord,'->',deg-min*minute-sec*second
+            print(coord,'->',deg-min*minute-sec*second)
             
 
 def main():
             
 
 def main():