jeudi 1 février 2018

Python check if int is in certain object of list

i currently have a result set with the following data:

((0L, datetime.date(2018, 1, 29)), (0L, datetime.date(2018, 1, 30)), (0L, 
datetime.date(2018, 1, 31)), (0L, datetime.date(2018, 2, 1)))

I am trying to check if the current date has the status 0 or 1.

Currently i do this:

   if checkdate():
        if result_set[0] == 1:

The checkdate function checks if the currentdate is inside the list somewhere. But there i'm stuck trying to figure out if that date has the status 1 or 0. The status is the first item on the list (0l and 1L) mysql somehow adds a L after the 0 and 1.

Currently my checkdate function looks like this:

return any(d[1] == cd for d in result_set)

Would love some help!

Aucun commentaire:

Enregistrer un commentaire