时间字符串转时间格式并求时间间隔

#补全时间
def full_time(times):
if len(times)<10:
times = times+" 0:00:01"
return time.strptime(times, '%Y/%m/%d %H:%M:%S')


#将时间字符串转成时间格式
def time_strut_to_time(time_str):
time_stru = full_time(time_str)
y,m,d,H,M,S = time_stru[0:6]
timeT = datetime.datetime(y,m,d,H,M,S)
return timeT
#时间差
times = times.apply(lambda x: time_strut_to_time(x))

diff = (times[i+1]-times[i]).seconds

【时间字符串转时间格式并求时间间隔】

    推荐阅读