📜  随机字符串生成 python 2.7 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:55.964000             🧑  作者: Mango

代码示例1
>>> import string
>>> import random
>>> def id_generator(size=6, chars=string.ascii_uppercase + string.digits):
    return ''.join(random.choice(chars) for _ in range(size))