问题
Given a ISO 8601 duration string, how do I convert it into a datetime.timedelta
?
This didn't work:
timedelta("PT1H5M26S", "T%H%M%S")
回答1:
I found isodate library to do exactly what I want
isodate.parse_duration('PT1H5M26S')
来源:https://stackoverflow.com/questions/36976138/is-there-an-easy-way-to-convert-iso-8601-duration-to-timedelta