12345678910111213141516171819202122232425262728 |
- #!/usr/bin/python3
- import sys
- def error():
- print("d:NO_DATA")
- print("m:NO_DATA")
- print("s:NO_DATA")
- exit(1)
- if len(sys.argv) < 2:
- error()
- try:
- deg = float(sys.argv[1])
- except:
- print("Can't convert it to float")
- error()
- m, s = divmod(abs(deg)*3600, 60)
- d, m = divmod(m, 60)
- if deg < -1:
- d = -d
- d, m = int(d), int(m)
- print("d:"+str(d))
- print("m:"+str(m))
- print("s:{:.4f}".format(s));
|