string conversion and formatters
Spiffy
clams17 at yahoo.com
Fri Dec 7 16:23:48 EST 2001
Doh!
Wow, you guys are the best...the BEST!! Thanks for your help. What a great
community thang Python's got going here. Hopefully, I will be able to
contibute in a meaningful way someday...
Here's my re-write and ...IT WORKS NOW!!
#Decimal/Hex Convertor
def print_options():
print """Options:
'a' Decimal to Hex
'b' Hex to Decimal
'c' print options
'd' quit"""
choice = "c"
while choice != "d":
if choice == "a":
dec = input("Decimal: ")
print "Hex: %X" % dec
elif choice == "b":
hek = raw_input("Hex: ")
print "Decimal: %d" % int(hek,16)
elif choice == "c":
print_options()
choice = raw_input("option: ")
Now I just need to write a GUI for it! Wish me luck...
More information about the Python-list
mailing list