根据日期生成一个唯一标识的文本值

import time
from  datetime  import  * 
print datetime.now()
dt=datetime.now()
print dt.hour
if dt.hour<10:
      ss=str(dt.year)+str(dt.month)+str(dt.day)+'0'+str(dt.hour)+str(dt.minute)+str(dt.second)
else:
     ss=ss=str(dt.year)+str(dt.month)+str(dt.day)+str(dt.hour)+str(dt.minute)+str(dt.second)

print ss

 

posted @ 2016-10-11 15:04  idea678  阅读(120)  评论(0编辑  收藏  举报