to32 should start with capital letter or number
This commit is contained in:
parent
fc22335f8e
commit
0e9f149edb
1 changed files with 6 additions and 9 deletions
15
ox/format.py
15
ox/format.py
|
@ -16,25 +16,22 @@ def to32(q):
|
||||||
'0'
|
'0'
|
||||||
|
|
||||||
>>> to32(347485647)
|
>>> to32(347485647)
|
||||||
'aBcDeF'
|
'AbCdEf'
|
||||||
|
|
||||||
>>> to32(555306645)
|
>>> to32(555306645)
|
||||||
'gHjKmN'
|
'GhJkMn'
|
||||||
|
|
||||||
>>> to32(555306645)
|
|
||||||
'gHjKmN'
|
|
||||||
|
|
||||||
>>> to32(800197332334559L)
|
>>> to32(800197332334559L)
|
||||||
'pQrStVwXyZ'
|
'PqRsTvWxYz'
|
||||||
|
|
||||||
>>> to32(32)
|
>>> to32(32)
|
||||||
'10'
|
'10'
|
||||||
|
|
||||||
>>> to32(119292)
|
>>> to32(119292)
|
||||||
'3MfW'
|
'3mFw'
|
||||||
|
|
||||||
>>> to32(939387374)
|
>>> to32(939387374)
|
||||||
'vZvTfE'
|
'VzVtFe'
|
||||||
|
|
||||||
>>> to32(-1)
|
>>> to32(-1)
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
|
@ -45,7 +42,7 @@ def to32(q):
|
||||||
if q < 0: raise ValueError, "must supply a positive integer"
|
if q < 0: raise ValueError, "must supply a positive integer"
|
||||||
letters = "0123456789ABCDEFGHJKMNPQRSTVWXYZ"
|
letters = "0123456789ABCDEFGHJKMNPQRSTVWXYZ"
|
||||||
converted = []
|
converted = []
|
||||||
upper = True
|
upper = False
|
||||||
while q != 0:
|
while q != 0:
|
||||||
q, r = divmod(q, 32)
|
q, r = divmod(q, 32)
|
||||||
l = letters[r]
|
l = letters[r]
|
||||||
|
|
Loading…
Reference in a new issue