0

I want to create a .datetime() with a list of numbers. I have a tuple through which I can iterate through to get the year, month, day, hour, minute and second printed on separate lines. I want to convert the time tuple to a datetime object.

Here is the code:

import datetime
time = (2020, 7, 24, 10, 54, 40)

for t in time:
    print(t)

If I do something like: datetime.datetime(time) it does not work.

I have searched on google but couldn't find an answer. If someone could point me towards the right direction, I will be grateful. Thank you

0 Answers0