How to create a GUID/UUID in Python
问题 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: The uuid module, in Python 2.5 and up, provides RFC compliant UUID generation. See the module docs and the RFC for details. [source] Docs: Python 2: http://docs.python.org/2/library/uuid.html Python 3: https://docs.python.org/3/library/uuid.html Example (working on 2 and 3): >>> import uuid