title: Mixing List and Dict in Python
body: <p>I was wondering how do you mix list and dict together on Python? I know on PHP, I can do something like this:</p>
  
  <pre><code>$options = array(
      "option1", 
      "option2", 
      "option3" =&gt; array("meta1", "meta2", "meta3"), 
      "option4" 
  );
  </code></pre>
  
  <p>The problem is python have different bracket for different list. () for tuple, [] for list, and {} for dict. There don't seems to be any way to mix them and I'm keep getting syntax errors.</p>
  
  <p>I am using python 2.7 now. Please advice how to do it correctly.</p>
  
  <p>Much thanks,</p>
  
  <p>Rufas</p>
  
  <p>Update 1:</p>
  
  <p>I'll slightly elaborate what I'm trying to do. I am trying to write a simple python script to do some API requests here:</p>
  
  <p><a href="http://www.diffbot.com/products/automatic/article/" rel="nofollow">http://www.diffbot.com/products/automatic/article/</a></p>
  
  <p>The relevant part is the fields query parameters. It is something like ...&amp;fields=meta,querystring,images(url,caption)... . So the above array can be written as (in PHP)</p>
  
  <pre><code>$fields = array(
      'meta',
      'querystring',
      'images' =&gt; array('url', 'caption')
  );
  </code></pre>
  
  <p>And the $fields will be passed to a method for processing. The result will be returned, like this:</p>
  
  <pre><code>$json = diffbot-&gt;get("article", $url, $fields);
  </code></pre>
  
  <p>The thing is - I have no problem in writing it in PHP, but when I try to write it in Python, the thing is not as easy as it seems...</p>