Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. def log(*args, **kwargs):
  2. # time.time() 返回 unix time
  3. # 如何把 unix time 转换为普通人类可以看懂的格式呢?
  4. format = '%H:%M:%S'
  5. value = time.localtime(int(time.time()))
  6. dt = time.strftime(format, value)
  7. with open('log.gua.txt', 'a', encoding='utf-8') as f:
  8. print(dt, *args, file=f, **kwargs)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement