amazon web services - Converting AWS date string to python datetime -


i'm trying aws timestamp converted python string datetime object. datetime format aws provides here 2016-09-20t17:21:14+00:00

this code have trying convert:

import csv datetime import datetime ifile = open('text_results.txt') reader = csv.reader(ifile)       row in reader:  date_s = str(row[2])  date_o = datetime.strptime('date_s', '%y-%m-%dt%h:%m:%s+00:00') 

i don't care milliseconds if there way omit since aws doesn't provide milliseconds, it's 00:00. i'm receiving following error code:

traceback (most recent call last):   file "date.py", line 15, in <module>     date_o = datetime.strptime('date_s', '%y-%m-%dt%h:%m:%s+00:00')   file "/usr/local/cellar/python/2.7.12_2/frameworks/python.framework/versions/2.7/lib/python2.7/_strptime.py", line 332, in _strptime     (data_string, format)) valueerror: time data 'date_s' not match format '%y-%m-%dt%h:%m:%s+00:00' 


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -