blob: 8d344502820602c7ef4373dcc2041c617d2845fe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#!/usr/bin/env python
table = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
def convert(current):
# Possibilities with each character
# 1: 36 = 36
# 2: 36*36 = 1296
# 3: 36*36*36 = 46656
res = ""
length = len(table) - 1
if current / length > 0:
res += convert(current / length)
res += table[current % length]
return res
|