Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/349.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Python中显示字符串中的日期_Python - Fatal编程技术网

在Python中显示字符串中的日期

在Python中显示字符串中的日期,python,Python,可能重复: 我在python中有以下字符串: 2011-05-25T02:11:04Z 如何将其转换为 May, 25th 2:11 datetime.datetime.strtime('2011-05-25T02:11:04Z','%Y-%m-%dT%H:%m:%SZ')提供了一个具有正确日期/时间的datetime.datetime对象。您也可以使用,因为该字符串是有效的日期字符串。

可能重复:

我在python中有以下字符串:

2011-05-25T02:11:04Z 
如何将其转换为

May, 25th 2:11

datetime.datetime.strtime('2011-05-25T02:11:04Z','%Y-%m-%dT%H:%m:%SZ')
提供了一个具有正确日期/时间的
datetime.datetime
对象。

您也可以使用,因为该字符串是有效的日期字符串。