关于时间

随机生成时间的字符串

  1. def tid_maker(): 
  2. return '{0:%Y%m%d%H%M%S%f}'.format(datetime.datetime.now())
     
    后面加了生成随机数
     
     
    def tid_maker():
    return '{0:%Y%m%d%H%M%S%f}'.format(datetime.datetime.now())+''.join([str(random.randint(1,10)) for i in range(5)])

原贴

https://blog.csdn.net/u011085172/article/details/80676066

时间datetime详解

https://www.cnblogs.com/cindy-cindy/p/6720196.html

猜你喜欢

转载自www.cnblogs.com/BugPudge/p/10317711.html