[Tutor] RE: Base converter bases 2-62

Jeff Shannon jeff@ccvcorp.com
Fri Jun 20 15:41:02 2003


cino hilliard wrote:

>> (Of course, as Magnus pointed out, this whole loop can be easily 
>> replaced with 'dec = int(num, r1)' as long as you can cope with a 
>> maximum base of 32....
>
> Why even mention this? I went to all this trouble for base 32 max? the 
> atol and ltoa in c do this
> for you to base 36.
>

Whoops, I *meant* base 36, which is the documented maximum radix for 
int().  Python (and I believe the C library functions) don't distinguish 
between upper and lower case for these conversions, which means that 
there's 26 alpha + 10 numeric symbols available.  It's certainly 
possible to use a wider range of symbols, but probably not of any 
practical value.

Jeff Shannon
Technician/Programmer
Credit International