title: Python use %s in dict to call value
body: <p>How can we use dict similar to the following?</p>
  
  <pre><code>dict[%s] % variable
  </code></pre>
  
  <p>For those who are interested in what I am trying to do exactly, I have three dicts:</p>
  
  <pre><code>    dict_1 = {'a':'123', 'b':'234', 'c':'345'}
      dict_2 = {'d':'456', 'e':'567', 'f':'678'}
      dict_3 = {'a':'e', 'b':'d', 'c':'f'}
  </code></pre>
  
  <p>And I have a function where I need to input something like:</p>
  
  <pre><code>    function(dict_1['a'], dict_2['e']) #according to dict_3 that 'a' is paired with 'e'.
  </code></pre>
  
  <p>Edited:</p>
  
  <p>I was trying to write a for loop to loop over all the dicts and have them pair dict_1 and dict_2 pairs into the function according to dict_3. I actually don't need the %s thing after looking at you guys answer. That's what happens what you try to code without coffee in the morning lol.</p>
  
  <p>And in the end, this following did what I wanted, thanks all!:</p>
  
  <pre><code>    for i in dict_1:
           results = function(dict_1[i],dict_2[dict_3[i]]
  </code></pre>