reddit源代码可用!以下是我发现生成该字符串的内容:
def to_base(q, alphabet): if q < 0: raise ValueError, "must supply a positive integer" l = len(alphabet) converted = [] while q != 0: q, r = divmod(q, l) converted.insert(0, alphabet[r]) return "".join(converted) or '0' def to36(q): return to_base(q, '0123456789abcdefghijklmnopqrstuvwxyz')
和其他地方,在"链接"类下:
@property def _id36(self): return to36(self._id)