Base 62 conversion in Python

Posted by mikl on Stack Overflow See other posts from Stack Overflow or by mikl
Published on 2009-07-13T14:19:41Z Indexed on 2010/03/31 0:03 UTC
Read the original article Hit count: 275

Filed under:
|
|

How would you convert an integer to base 62 (like hexadecimal, but with these digits: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ').

I have been trying to find a good Python library for it, but they all seems to be occupied with converting strings. The Python base64 module only accepts strings and turns a single digit into four characters. I was looking for something akin to what URL shorteners use.

© Stack Overflow or respective owner

Related posts about python

Related posts about base62