• UUID是根据MAC以及当前时间等创建的不重复的随机字符串
import uuid

# Generate a UUID from a host ID, sequence number, and the current time
>>> uuid.uuid1()

# Generate a UUID from the MD5 hash of a namespace UUID and a name
>>> uuid.uuid3(uuid.NAMESPACE_DNS, 'python.org')

# Generate a random UUID
>>> uuid.uuid4()

# Generate a UUID from the SHA-1 hash of a namespace UUID and a name
>>> uuid.uuid5(uuid.NAMESPACE_DNS, 'python.org')

# make a UUID from a string of hex digits(braces and hypens ignored)
>>> x = uuid.UUID('{00010203-0405-0607-0809-0a0b0c0d0e0f}')

# convert a UUID to a string of hex digits in standard form
>>> str(x)

相关文章:

  • 2021-09-30
  • 2021-07-13
  • 2021-08-08
  • 2021-09-21
  • 2022-12-23
  • 2022-02-11
  • 2022-02-06
  • 2022-12-23
猜你喜欢
  • 2022-03-01
  • 2021-09-09
  • 2022-12-23
  • 2021-05-28
  • 2021-12-19
  • 2021-12-24
相关资源
相似解决方案