class - uuid

 

 


Example

 

>>> import uuid

# uuid 是一個 immutable UUID objects
# 有分有 Version: uuid1(), uuid3(), uuid4(), uuid5()
# uuid4() creates a random UUID

>>> myUUID = uuid.uuid4()

>>> myUUID

UUID('6951de81-7700-4da0-9874-bdb7c2ab99e0')

# UUID objects 轉換成 String object

>>> str(myUUID)

'6951de81-7700-4da0-9874-bdb7c2ab99e0'

# 轉成 hex 數字

>>> myUUID.hex

'6951de8177004da09874bdb7c2ab99e0'

# String Obj -> UUID Obj

>>> uuid.UUID('6951de81-7700-4da0-9874-bdb7c2ab99e0')

 


 

Creative Commons license icon Creative Commons license icon