xuuid.py 261 B

12345678910111213141516
  1. # update: 2021-6-28-19
  2. import uuid
  3. def is_uuid4(string):
  4. """验证uuid4"""
  5. try:
  6. uuid.UUID(string, version=4)
  7. return True
  8. except ValueError:
  9. return False
  10. def new_uuid4():
  11. """生成uuid4"""
  12. return str(uuid.uuid4())