Create UUID with Zeros in Python

Viewed 1862

In python how can a UUID be created with all zero values?

There is a similar question that is asked and answered for java, this question is specific to python.

2 Answers

According to the docs:

import uuid
uuid.UUID(int=0)
# UUID('00000000-0000-0000-0000-000000000000')

You can use the UUID class, specifically, create it from the int 0:

import uuid
zero_uuid = uuid.UUID(int = 0)
Related