Python - Time data not match format

前端 未结 4 994
深忆病人
深忆病人 2021-01-27 00:42

I have string time in the following format

2016-12-10T13:54:15.294

I am using the following method to format the time:

time.strptime(

4条回答
  •  耶瑟儿~
    2021-01-27 01:05

    I think your date format is incorrectly specified in string. This should work:

    import datetime
    a = '2016-12-10T13:54:15.294'
    b= datetime.datetime.strptime(a,'%Y-%m-%dT%H:%M:%S.%f')
    print b
    

提交回复
热议问题