I have a SQL query result of 695 records
which I need to strip out the matches to my 52 items in _ids
list.
_ids = [44226, 44303, ...]
records = [
(44226, datetime.datetime(2019, 8, 27, 10, 0), datetime.datetime(2019,
8, 27, 21, 0), '0.50'),
(44227, datetime.datetime(2019, 8, 30, 18, 0), datetime.datetime(2019,
8, 30, 22, 30), '0'), ...
]
Using the Is there a short contains function for lists? and looping over my records
is always resulting in True
.
for i in records:
if i[0] not in _ids:
# pop from list
Any recommendations to efficiently return list only list of records that match _ids
list?