You can use the strptime function.
For instance, that would give:
myDatetime = datetime.strptime(myString.split(".")[0], "%Y-%m-%dT%H:%M:%S")
[EDIT] Well, I've seen this has been treated in another thread with a better answer than mine: How do I parse an ISO 8601-formatted date and time?How do I parse an ISO 8601-formatted date and time?