1>>> import uuid
2>>> uuid.uuid4()
3UUID('bd65600d-8669-4903-8a14-af88203add38')
4>>> str(uuid.uuid4())
5'f50ec0b7-f960-400d-91f0-c42a6d44e3d0'
6>>> uuid.uuid4().hex
7'9fe2c4e93f654fdbb24c02b15259716c'
8
1# Python3 code to generate the
2# random id using uuid1()
3
4import uuid
5
6# Printing random id using uuid1()
7print ("The random id using uuid1() is : ",end="")
8print (uuid.uuid1())
1>>> import uuid
2
3>>> # make a random UUID
4>>> uuid.uuid4()
5UUID('bd65600d-8669-4903-8a14-af88203add38')
6
7>>> # Convert a UUID to a string of hex digits in standard form
8>>> str(uuid.uuid4())
9'f50ec0b7-f960-400d-91f0-c42a6d44e3d0'
10
11>>> # Convert a UUID to a 32-character hexadecimal string
12>>> uuid.uuid4().hex
13'9fe2c4e93f654fdbb24c02b15259716c'
14