Python custom datetime(?) format handling
问题 Let's say i have a string representing a time with number of day of the week: For example '52300', which means 5th day of week(Friday), 23 Hours 00 Minutes. How do i parse it to time or datetime object to add a timedelta(hours=3) and get it back to this strange format? Expected output is '60200' string. I have tried: tow_str = '52300' tow = datetime.datetime.strptime(tow_str, "%w%H%M") + datetime.timedelta(hours=3) print(tow.strftime("%w%H%M")) which returns '20200' instead of '60200' 回答1: