Thursday, 15 January 2015

python - Searching for a word in a nested list -



python - Searching for a word in a nested list -

i trying write function searches in list:

def search(inlist, matches): li in inlist: m in matches: if m in li: homecoming li homecoming none l = [("daniel", "20th november", "tenochtitlan"), ("arturo", 17, "17th october")]

here, example, looking birthdate of daniel.

i have define search i'm not sure how go here.

from code written there got this:

l = [("daniel", "20th november", "tenochtitlan"), ("arturo", 17, "17th october")] info = search(l, ['daniel']) #data ("daniel", "20th november", "tenochtitlan") d in data: #regexp find specific, homecoming value if someregexp.match(d): homecoming d

but have more specific if want more specific answer.

python list search

No comments:

Post a Comment