I am trying to insert a date object in a list. But, on execution, the code raises a TypeError. Here's the code:
values.append(datetime.date(tuple(checkIn)))
values.append(datetime.date(tuple(checkOut)))
For viewing pleasure, I provided only the lines that raises the error.
Here,
valuesis a listcheckInandcheckOutare lists. eg-checkIn = [2020, 11, 28]
This is the error message:
File "d:/coding/python/hms.py", line 195, in booking
values.append(dt.date(tuple(checkIn)))
TypeError: an integer is required (got type tuple)
So, why can't I insert tuple into a list?