convert_ll_dec.py 225 B

1234567891011121314
  1. #!/usr/bin/python3
  2. import sys
  3. deg = float(sys.argv[1])
  4. m, s = divmod(abs(deg)*3600, 60)
  5. d, m = divmod(m, 60)
  6. if deg < -1:
  7. d = -d
  8. d, m = int(d), int(m)
  9. print("d:"+str(d))
  10. print("m:"+str(m))
  11. print("s:{:.4f}".format(s));