uuid.uuid4()
uuid.uuid4() is a Python function in the UUID Module category. Generates a random UUID (version 4). Most commonly used UUID type. The syntax is uuid.uuid4(). Returns: UUID object. A typical example: import uuid
uuid.uuid4() # UUID("550e8400-e29b-41d4-a716-446655440000"). A close sibling is uuid.uuid1(), which generates a time-based UUID (version 1) using host MAC address and timestamp. A close sibling is uuid.uuid3(), which generates a UUID v3 from a namespace UUID and a name (MD5 hash). A close sibling is uuid.uuid5(), which generates a UUID v5 from a namespace UUID and a name (SHA-1 hash). A close sibling is uuid.UUID, which creates a UUID object from hex string, bytes, or other representations. More about this category: UUID generation — uuid1, uuid3, uuid4, uuid5. Related UUID Module entries: uuid.uuid1(), uuid.uuid3(), uuid.uuid5(), uuid.UUID. This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details.