python - Check if word is inside of list of tuples -
i'm wondering how can efficiently check whether value inside given list of tuples. have list of:
("the", 1) ("check", 1) ("brown, 2) ("gary", 5)
how can check whether given word inside list, ignoring second value of tuples? if word use
if "the" in wordlist: #...
but not work, there along line can do?
if ("the", _) in wordlist: #...
may use hash
>>> word in dict(list_of_tuples)
Comments
Post a Comment