def int2base(num, base, abc="0123456789abcdefghijklmnopqrstuvwxyz"):
if num < 0:
return '-' + int2base(-num, base, abc)
else:
output = abc[num % base] # rightmost digit
while num >= base:
num //= base # move to next digit to the left
output = abc[num % base] + output # this digit
return output
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter