Python时间字符串转时间戳

import time

dt = '2020-01-01 00:00:00'
ts = int(time.mktime(time.strptime(dt, "%Y-%m-%d %H:%M:%S")))
print(ts)