Parse rfc3339 date strings in Python? [duplicate]
问题 This question already has answers here : How do I parse an ISO 8601-formatted date? (26 answers) Closed 4 years ago . I have a datasets where all the dates have the following format: 2012-10-09T19:00:55Z I'd like to be able to be able to use methods like .weekday on them. How do I convert them to the proper format in Python? 回答1: You can use dateutil.parser.parse to parse strings into datetime objects. dateutil.parser.parse will attempt to guess the format of your string, if you know the