Re: Unconverted data remains
Nikhil Verma wrote:
> I have a list :-
> L = ['Sunday November 11 2012 9:00pm ', 'Thursday November 15 2012
> 7:00pm ',\
> 2012 7:00pm ']
> final_event_time = [datetime.strptime(iterable, '%A %B %d %Y %I:%M%p') for
> iterable in L]
> and having this error Unconverted data remains . I am trying to convert
> all these in datetime object.
Your date strings have trailing whitespace, try changing the format to
final_event_time = [datetime.strptime(s, '%A %B %d %Y %I:%M%p ') for s in L]
or apply strip to the date strings:
final_event_time = [datetime.strptime(s.strip(), '%A %B %d %Y %I:%M%p') for
s in L]
|All times are GMT. The time now is 08:27 PM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.