Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (47.6k points)

How do I create a GUID in Python that is platform independent? I hear there is a method using ActivePython on Windows but it's Windows only because it uses COM. Is there a method using plain Python?

1 Answer

0 votes
by (106k points)

To create GUID/UUID you can use the following piece of code:-

import uuid

uuid.uuid4()

str(uuid.uuid4()) 

uuid.uuid4().hex 

image

Related questions

0 votes
1 answer
asked Aug 8, 2019 in Web Technology by Sammy (47.6k points)
0 votes
1 answer
asked Jul 30, 2019 in Java by Krishna (2.6k points)
0 votes
1 answer

31k questions

32.4k answers

500 comments

693 users

Browse Categories

...