Say we have a list like this:
['1987', '1994-04', '2001-05-03']
We would like to convert these strings into datetime
objects with a consistent format, then back into strings, something like this:
['1987-01-01', '1994-04-01', '2001-05-03']
In this case, we have decided if the date doesn't contain a month or a day, we set it to the first of that respective field. Is there a way to achieve this using a datetime or only by string detection?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…