固定长度的uuid和生成guid
生成uuid
import shortuuid def get_unique_id(): su = shortuuid.ShortUUID(alphabet="0123456789") _id = int(su.random(length=19)) return _id
19 位的guid
import shortuuid def get_unique_id(): su = shortuuid.ShortUUID(alphabet="0123456789") _id = int(su.random(length=19)) if 1000000000000000000 < _id < 9223372036854775807: return _id return get_unique_id()