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

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -