1. 程式人生 > >python模組uuid產生唯一id

python模組uuid產生唯一id

 

使用版本4:uuid4就可以了

UUID4缺點:糟糕的隨機數發生器使得它更有可能發生碰撞,但是概率真的很小

UUID1缺點:暴露隱私

 

If all you want is a unique ID, you should probably call uuid1() or uuid4(). Note that uuid1() may compromise privacy since it creates a UUID containing the computer’s network address. 

uuid4()creates a random UUID.

 

參考:https://docs.python.org/3.8/library/uuid.html

https://pythoncaff.com/docs/pymotw/uuid-universally-unique-identifiers/156