python中datetime与string的相互转换
>>> import datetime >>> value = '2016-10-30 01:48:31' >>> datetime.strptime(value,'%Y-%m-%d %H:%M:%S') datetime.datetime(2016, 10, 30, 1, 48, 31) >>> A=datetime.strptime(value,'%Y-%m-%d %H:%M:%S') >>> A datetime.datetime(2016, 10, 30, 1, 48, 31)