Python parsing date with strptime
问题 I have url that returns date in this format url_date = "2015-01-12T08:43:02Z" I don't know why there are strings, it would have been simpler to get it as "2015-01-1208:43:02" which would have been simpler to parse using datetime.datetime.strptime(url_date , '%Y-%m-%d') but it does not work. I have tried with %Y-%m-%d %Y-%m-%d-%H-%M-%S %Y-%m-%d-%H-%M-%S-%Z But I keep getting errors like "time data 2015-01-12T08:43:02Z does not match ..." 回答1: The format you are looking for is - '%Y-%m-%dT%H:%M