Anonymous user
Non-decimal radices/Convert: Difference between revisions
→{{header|Python}}
m (→{{header|REXX}}: added REXX language.) |
|||
Line 901:
=={{header|Python}}==
Converting from string to number is easy:
<lang python>i = int('1a',16) # returns the integer 26</lang>▼
Converting from number to string is harder:
<lang python>digits = "0123456789abcdefghijklmnopqrstuvwxyz"
def baseN(num,b):
Line 917 ⟶ 920:
k = 26
s = baseN(k,16) # returns the string 1a</lang>
▲i = int('1a',16) # returns the integer 26</lang>
=={{header|REXX}}==
|