Right now I have:
timestamp = datetime.strptime(date_string, \'%Y-%m-%d %H:%M:%S.%f\')
This works great unless I\'m converting a string tha
You could use a try/except block:
try/except
try: timestamp = datetime.strptime(date_string, '%Y-%m-%d %H:%M:%S.%f') except ValueError: timestamp = datetime.strptime(date_string, '%Y-%m-%d %H:%M:%S')