Convert unicode to datetime proper strptime format

后端 未结 2 1547
鱼传尺愫
鱼传尺愫 2020-12-30 03:58

I am trying to convert a unicode object to a datetime object.

I read through the documentation: http://docs.python.org/2/library/time.html#time.strptime

and

2条回答
  •  天涯浪人
    2020-12-30 04:33

    One option is to let dateutil do the job:

    >>> from dateutil import parser
    >>> parser.parse('2014-01-15T01:35:30.314Z')
    datetime.datetime(2014, 1, 15, 1, 35, 30, 314000, tzinfo=tzutc())
    

提交回复
热议问题