def transform36(n): res = [] while n: res.append(n%36) n = n//36 out = [] for rr in res[::-1]: if 0 <= rr <= 9: out.append(str(rr)) else: out.append(chr(rr +ord('a')-10)) return ''.join(out) # 简单测试一下 print(transform36(int(36 * 35))) # z0
标签:transform36,10,转换,进制,res,36 From: https://www.cnblogs.com/zle1992/p/17519722.html