Valueerror: Time Data 'in 00 Days 23:07:56' Does Not Match Format 'in %d Days %h:%m:%s'
I am trying to parse my date string with time library. But i have an error in parsing. # Example is 'In 0 days 23:07:56' client['license_time_start'] = time.strptime('In 0 days 23
Solution 1:
The error is because date can't be 0
. It has to be an positive integer.
Therefore, this produces an error:-
time.strptime('In 0 days 23:07:56', 'In %d days %H:%M:%S')
# ValueError: time data 'In 0 days 23:07:56' does notmatchformat'In %d days %H:%M:%S'
This doesn't:-
time.strptime('In 01 days 23:07:56', 'In %d days %H:%M:%S')
# time.struct_time(tm_year=1900, tm_mon=1, tm_mday=1, tm_hour=23, tm_min=7, tm_sec=56, tm_wday=0, tm_yday=1, tm_isdst=-1)
Post a Comment for "Valueerror: Time Data 'in 00 Days 23:07:56' Does Not Match Format 'in %d Days %h:%m:%s'"