I would like to convert two lists of strings into lists with one same time format.
Here are our two lists:
# first list: strings with UTC format
firstlist = ['2013-08-16T07:35:01Z','2012-11-17T17:07:49Z','2012-11-09T23:24:13Z']
# second list: strings with day-month-year format
secondlist = ['04-06-2016','31-10-2018','12-04-2019']
I would like to convert these two lists and get the same format year-month-day
for each item:
['2013-08-16','2012-11-17','2012-11-09'] # expected for the first list
['2016-06-04','2018-10-31','2019-04-12'] # expected for the second list
I tried with just one item per list:
import time
time.strptime("2013-08-16T07:35:01Z", "%d %m %y")
time.strptime("04-06-2016", "%d %m %y")
But I get an error:
ValueError: time data '2013-08-16T07:35:01Z' does not match format '%d %m %y'
I found these two documentations: time and datetime.
But I am still really confused. There is probably something wrong with my method, but I struggle to find the right one for this case.