2020-11-28

python function. output a keys list from a dictionary if the key is todays date

i import datetime module. but i'm not sure how to call it as a dictionary key.

def bad_food():
    today = datetime.date.today()
    past_due = {
        datetime.date.today(2020,11,24): ['chicken' , 'soup', 'chips'],
        datetime.date.today(2020,11,27) : ['lays', 'chilli'],
                }
    for key in past_due:
        if key == today:
            print (today.values())
print(bad_food())```


from Recent Questions - Stack Overflow https://ift.tt/37cQwKl
https://ift.tt/eA8V8J

No comments:

Post a Comment