Generate UUID in Python

Python offers UUID generation in its standard library


import uuid

# generate UUID version 1 - time based
uuid.uuid1()

# generate UUID version 3 - deterministic and hashed with MD5
uuid.uuid2(uuid.uuid4(), "name")

# generate UUID version 4 - random
uuid.uuid4()

# generate UUID version 5 - deterministic and hashed with SHA-1
uuid.uuid5(uuid.uuid4(), "name")

How do I generate UUID in...

Find out how to generate UUIDs in your favorite language here: Bash, Groovy, Kotlin, Scala, Clojure, ClojureScript, Java, JavaScript, or return to Online UUID Generator