title: python dictionary key not working
body: <p>I'm having trouble accessing some values in a dictionary I made. In my code, I made two different dictionaries while reading through a file. The code I have is this:</p>
  
  <pre><code>nonterminal_rules = defaultdict(list)
  terminal_rules = defaultdict(list)
  
  for line in open(file, 'r').readlines():
      LHS,RHS = line.strip().split("-&gt;")
      if RHS[1] == "'" and RHS[-1] == "'" :
          terminal_rules[LHS].append(RHS.strip())
      else:
          nonterminal_rules[LHS].append(RHS.split())
  
  for i in nonterminal_rules:
      for j in nonterminal_rules[i]:
          if len(j) == 1:
              x = terminal_rules[j[0]])
  </code></pre>
  
  <p>Here are the keys and values to my dict:</p>
  
  <pre><code>print(self.original_grammar.terminal_rules.items())
  dict_items([('NN ', ["'body'", "'case'", "'immunity'", "'malaria'", "'mouse'", "'pathogen'", "'research'", "'researcher'", "'response'", "'sepsis'", "'system'", "'type'", "'vaccine'"]), ('NNS ', ["'cells'", "'fragments'", "'humans'", "'infections'", "'mice'", "'Scientists'"]), ('Prep ', ["'In'", "'with'", "'in'", "'of'", "'by'"]), ('IN ', ["'that'"]), ('Adv ', ["'today'", "'online'"]), ('PRP ', ["'this'", "'them'", "'They'"]), ('Det ', ["'a'", "'A'", "'the'", "'The'"]), ('RP ', ["'down'"]), ('AuxZ ', ["'is'", "'was'"]), ('VBN ', ["'alerted'", "'compromised'", "'made'"]), ('Adj ', ["'dendritic'", "'immune'", "'infected'", "'new'", "'Systemic'", "'weak'", "'whole'", "'live'"]), ('VBN  ', ["'discovered'"]), ('Aux ', ["'have'"]), ('VBD ', ["'alerted'", "'injected'", "'published'", "'rescued'", "'restored'", "'was'"]), ('COM ', ["','"]), ('PUNC ', ["'?'", "'.'"]), ('PossPro ', ["'their'", "'Their'"]), ('MD ', ["'Will'"]), ('Conj ', ["'and'"]), ('VBP ', ["'alert'", "'capture'", "'display'", "'have'", "'overstimulate'"]), ('VB  ', ["'work'"]), ('VBZ ', ["'invades'", "'is'", "'shuts'"]), ('NNP ', ["'Dr'", "'Jose'", "'Villadangos'"])])
  </code></pre>
  
  <p>Let's say I have the key-value pair {Aux:["have"]}.
  The problem is, if i = Aux, for example, x is just set as an empty list, when I actually want to be equal to ["have"]. </p>
  
  <p>I'm not sure what I'm doing/accessing incorrectly. Any ideas? Thanks!</p>