Generate a UUID in Python


Python tip:

With Python's uuid module, you can generate a Universally Unique Identifier. While the module provides four different UUID versions (1, 3, 4, and 5), you'll probably want to use version 4, uuid4, since it produces a random UUID:

import uuid

print(uuid.uuid4())
# -> 4388b8ef-caa8-43b5-b7e6-4ef9ab89fe51