#时间戳转字符串
import time
format_str = "%Y-%m-%d %H:%M:%S"
timestamp = time.time()
timestr = time.strftime(format_str, time.localtime(timestamp))
#字符串转时间戳
time_array = time.strptime(timestr,format_str)
time_stamp = time.mktime(time_array)
#时间戳转字符串
import time
format_str = "%Y-%m-%d %H:%M:%S"
timestamp = time.time()
timestr = time.strftime(format_str, time.localtime(timestamp))
#字符串转时间戳
time_array = time.strptime(timestr,format_str)
time_stamp = time.mktime(time_array)