Create UUID with Zeros in Python

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.

Upvotes: 13

Views: 7625

Answers (2)

Mureinik
Mureinik

Reputation: 311228

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

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

Upvotes: 6

0x5453
0x5453

Reputation: 13589

According to the docs:

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

Upvotes: 23

Related Questions