以下以2种方法生成唯一ID

def uuid_method():
    """第一种方法"""
    import uuid
    return str(uuid.uuid1())

print(uuid_method())

  

def time_method():
    """第二种方法"""
    import time, hashlib
    m = hashlib.md5()
    m.update(bytes(str(time.time()), encoding='utf-8'))
    return m.hexdigest()

print(time_method())

  

相关文章:

  • 2021-09-16
  • 2021-06-08
  • 2021-12-07
  • 2022-12-23
  • 2022-12-23
  • 2021-07-24
猜你喜欢
  • 2021-10-28
  • 2022-12-23
  • 2022-01-19
  • 2022-12-23
  • 2021-08-25
  • 2021-08-13
  • 2021-07-21
相关资源
相似解决方案