scripts

My personal collection of scripts
git clone git://src.gearsix.net/scriptsscripts.zip
Log | Files | Refs | Atom | README | LICENSE

h2d.py (raw) (306B)


   1 #!/usr/bin/env python3
   2 # hex to decimal
   3 # description: convert hexadecimal to decimal
   4 
   5 while (True):
   6     h = input('> ')
   7     try:
   8         print(int(h, 16))
   9     except ValueError:
  10         if h == 'q' or h == 'quit' or h == 'exit':
  11             exit()
  12         else:
  13             print(h, 'is not hexadecimal')