使用dateTime.strptime()时会遇到值错误
我正在使用dateTime.strptime()
,以转换从API接收到的TimesATMP字符串以分开日期和时间。一个示例之一:
from datetime import
datetime.strptime("2019-11-14T03:41:12.869000Z","%Y-%m-%dT%H:%M:%S.%f%
我不知道此“ 2019-11-14T03:41:12.869000Z”,“%y-%m-%dt%h:%m:%m:%s 。%f%z“
?
i am using datetime.strptime()
in order to convert the timesatmp string received from the API to separate the date and time. one of the example :
from datetime import
datetime.strptime("2019-11-14T03:41:12.869000Z","%Y-%m-%dT%H:%M:%S.%f%
and I can't figure out what is wrong with this "2019-11-14T03:41:12.869000Z","%Y-%m-%dT%H:%M:%S.%f%Z"
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
%z
IS 时区名称(如果对象是幼稚的,如果对象是空的) 。例如UTC
。如果尾随z
出现在您的所有字符串中使用z
而不是%z
,那就是输出
%Z
is Time zone name (empty string if the object is naive). for exampleUTC
. If trailingZ
appears in all your strings useZ
rather than%Z
, that isoutput
只需在Z之前删除%,它应该可以工作!
Just remove the % before Z and it should work!