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)

 


 


 


 

posted @ 2017-12-21 15:29  深度学习1  阅读(737)  评论(0编辑  收藏  举报