0

I have the following data:

d = set(("John", "Griffin"), ("Lisa","Kane"), ("Mike", "Doyle"), ...)

How do I check this data to see if it contains the first name "Ian" where I have tens of thousands of items in my set?

I guess something like this would work:

len((i for i in d if i[0] == "Ian")) > 0

but is there a more efficient way?

Baz
  • 12,713
  • 38
  • 145
  • 268

0 Answers0