unconverted data remains python strptime
Question: I am trying to convert strings to datetime in python, but I am getting an
error "unconverted data remains: 11". The strings I am dealing with have a
form like "Dec\xa031 2011". I think the unicode character is causing a
problem. I have tried splitting on \xa0 which gives me ['Dec', '31 2011'],
then joining. I have also tried replacing by re with re.sub('\xa0', '',
dateStr). Neither has worked.


Answer: That works for your example:

    
    
    import datetime
    s = "Dec\xa031 2011"
    datetime.datetime.strptime(s, "%b\xa0%d %Y")
    

Outputs:

    
    
    datetime.datetime(2011, 12, 31, 0, 0)
    

