skip to main
|
skip to sidebar
御前帶鍵盤的Python部落格
2010年7月22日 星期四
Python的UUID產出辦法
python的uuid模組有四種方式可以產生uuid
使用硬體及時間
以MD5對字串取值
隨機產生
使用SHA-1
以上分別對應的方式為:
#
-*- encoding: utf-8 -*-
import
uuid
print
uuid.uuid1()
print
uuid.uuid3(uuid.NAMESPACE_DNS,
'
testname
'
)
print
uuid.uuid4()
print
uuid.uuid5(uuid.NAMESPACE_DNS,
'
testme
'
)
沒有留言:
張貼留言
較新的文章
較舊的文章
首頁
訂閱:
張貼留言 (Atom)
網誌存檔
►
2011
(5)
►
6月
(2)
►
4月
(1)
►
1月
(2)
▼
2010
(3)
▼
7月
(2)
Python的UUID產出辦法
在寫GAE時,如果上傳檔案出現錯誤 TypeError: Blob() argument shou...
►
4月
(1)
►
2009
(1)
►
5月
(1)
►
2008
(5)
►
6月
(2)
►
5月
(3)
關於我自己
omusico
檢視我的完整簡介
沒有留言:
張貼留言