close

[Solved] ValueError: unconverted data remains: 02:05

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error ValueError: unconverted data remains: 02:05 in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How ValueError: unconverted data remains: 02:05 Error Occurs?

Today I get the following error ValueError: unconverted data remains: 02:05 in python.

How To Solve ValueError: unconverted data remains: 02:05 Error ?

  1. How To Solve ValueError: unconverted data remains: 02:05 Error ?

    To Solve ValueError: unconverted data remains: 02:05 Error Best answer is to use the from dateutil import parser.

  2. ValueError: unconverted data remains: 02:05

    To Solve ValueError: unconverted data remains: 02:05 Error Best answer is to use the from dateutil import parser.

Solution 1

The value of st at st = datetime.strptime(st, '%A %d %B') line something like 01 01 2013 02:05 and the strptime can’t parse this. Indeed, you get an hour in addition of the date… You need to add %H:%M at your strptime.

Solution 2

Best answer is to use the from dateutil import parser.

usage:

from dateutil import parser
datetime_obj = parser.parse('2018-02-06T13:12:18.1278015Z')
print datetime_obj
# output: datetime.datetime(2018, 2, 6, 13, 12, 18, 127801, tzinfo=tzutc())

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read