I need to compare two date string and for that, I need to convert the date string to datetime object. An example of a date string is "2015-08-23T03:36:30-05:00". I am assuming "-05:00" is the timezone string. I could to convert the string to datetime using below approach:
import datetime
str = '2015-08-23T03:36:30-05:00'
datetime.datetime.strptime(str,"%Y-%m-%dT%H:%M:%S-%f:00")
I can see the value of microsecond as 50000 which seems wrong to me as the -5:00 value is the timezone. What is the correct way to parse as I will be comparing two datetimes?

%fis the parser directive for parsing the microseconds part of the timestamp. The UTC offset directive is%z, but it uses a format without colon. So, if you can adjust the source format, you can go with the standard directives. Otherwise, you might have to come up with a custom regular expression.