title: How would I loop through a list of dictionaries and apply another for loop to each item within the list?
body: <p>I have the following list of dictionaries that must be in this format:</p>
  
  <pre><code>incident keywords = [{'INC000007581874': 'ccd browser'},
                       {'INC000007581947': 'CATIA'},
                       {'INC000007582037': 'Catia'}]
  </code></pre>
  
  <p>I need to apply a search function to each one of these dictionary entries within this list.</p>
  
  <p>I have been thinking a for loop is the way to go but I do not know how to implement it. I also am thinking that removing the 'query = 'ccd browser'' to being applicable to all values within the dictionaries might be a way of doing it but I am not sure how to do it.</p>
  
  <p>So through each loop, it would use 'ccd browser' then next it would use 'CATIA' and so on for all dictionaries within the list, however long the list is.</p>
  
  <pre><code>def look_up(id,keywords):
  
      # Ignores case
      keywords = keywords.lower()
      for item in incident_keywords:
          # if any value contains s
          if any([keywords in v.lower() for v in item.values()]):
              # spit out the item — this is a generator function
              yield item
  </code></pre>
  
  <p>The look_up() function searches for the word matches.</p>
  
  <pre><code>def search():
  
      query = 'ccd browser'
  
      print(' ')
  
      choices = []
      id = []
  
      # iterate over at most 50 first results (can be changed)
      for result in itertools.islice(look_up(id,query), 50):
          id.append(list(result.keys()))
          choices.append(list(result.values()))
  
      output = process.extract(query,choices,limit=20)
  
      # Tuple comprehension to remove strings from tuple pairings
      removed = [tuple(j for j in i if isinstance(j, int)) for i in output]
  
      print('')
  
      zipped = [{"Links:" : [list(zip(id, removed))]}]
  
      pprint.pprint(list(zip(incident_keywords_2, zipped)))
  </code></pre>
  
  <p>Search() function does the search but does not apply this to each entry within the list of dictionaries.</p>
  
  <p>Currently I am able to do this for the first entry within the list of dictionaries to give the output:</p>
  
  <pre><code>[({'INC000007581874': 'ccd browser'}},
    {'Links:': [[(['INC000007581874'], (100,))]]})]
  </code></pre>
  
  <p>But I need help to apply this process to every entry within the list of dictionaries to give an output similar to below, when applied to all entries within the list of dictionaries:</p>
  
  <pre><code>[({'INC000007581874': 'ccd browser'}},
    {'Links:': [[(['INC000007581874'], (100,))]]})]
  
  [({'INC000007581947': 'CATIA'}},
    {'Links:': [[(['INC000007581947': 'CATIA'], (100,))]], 
                [(['INC000007582037': 'Catia'], (100,))]})]
  
  [({'INC000007582037': 'Catia'}},
    {'Links:': [[(['INC000007582037': 'Catia'], (100,))]], 
                [(['INC000007581947': 'CATIA'], (100,))]})]
  </code></pre>