当前位置 : 主页 > 编程语言 > python >

Python:ULID通用唯一词典排序标识符

来源:互联网 收集:自由互联 发布时间:2022-10-26
Universally Unique Lexicographically Sortable Identifier (ULID) in Python 3 译文: Python 3中的通用唯一词典排序标识符(ULID) ULID 由 时间戳+随机字符串 组成 01AN4Z07BY 79KA1307SR9X4MV3|----------| |-------------

Universally Unique Lexicographically Sortable Identifier (ULID) in Python 3

译文: Python 3中的通用唯一词典排序标识符(ULID)

ULID 由 时间戳+随机字符串 组成

01AN4Z07BY 79KA1307SR9X4MV3 |----------| |----------------| Timestamp Randomness 10chars 16chars 48bits 80bits

文档

  • https://github.com/ahawker/ulid

安装

pip install ulid-py

示例

import ulid # 获取 ulid uid = ulid.new() print(uid) # 01GFHQYV8FH56G7FKP9JM612P2 print(type(uid)) # <class 'ulid.ulid.ULID'> # 获取字符串 print(uid.str) # 01GFHR0JM5CVN7KQVCZ1NVA2TK print(type(uid.str)) # <class 'str'>

参考 ULID - 一种比UUID更好的方案

上一篇:Python通过matplotlib包和gif包生成gif动画
下一篇:没有了
网友评论