pip install shortuuid
import shortuuid
shortuuid.get_alphabet()
result: '23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
shortuuid.set_alphabet("aaaaabcdefgh1230123")
shortuuid.get_alphabet()
result: '0123abcdefgh'
shortuuid.uuid()
result: 'cFja3vEJvqayZAxo6aFvcb'
shortuuid.uuid(name="baidu.com")
result: 'DM59euX6ET7uxUhruf56JK'
shortuuid.random(length=50)
result: 'D42ozXpg8zNDBDdXYz8D4s2j6PX3j5V3PF8hZkUbgTFAbh8wz2'
当需要在每个线程中有不用的字符集来产生uuid时,可以使用ShortUUID类
shortuuid.ShortUUID().random(length=22)