如何为Python中以下时间戳计算以分钟为单位的时间差?
2010-01-01 17:31:22 2010-01-03 17:31:22
from datetime import datetime fmt = '%Y-%m-%d %H:%M:%S' d1 = datetime.strptime('2010-01-01 17:31:22', fmt) d2 = datetime.strptime('2010-01-03 17:31:22', fmt) print (d2-d1).days * 24 * 60