title: Python Mechanize with Dynamic Dropdown Selection
body: <p>I'm using <a href="http://wwwsearch.sourceforge.net/mechanize/" rel="nofollow">mechanize</a> to fill forms and I run into a problem with dynamically-filled dropdown lists that are dependent on a previous selection.</p>
  
  <p>In mechanize, I do something like this to select the category:</p>
  
  <pre><code>import mechanize
  br = mechanize.Browser()
  """Select the form and set up the browser"""
  br["state"] = ["California"]
  br["city"] = ["San Francisco"] # this is where the error is
  br.submit()
  </code></pre>
  
  <p>I cannot choose the city as "San Francisco" until I have chosen the state as "California," because the city dropdown list is dynamically populated after choosing "California."</p>
  
  <p>How can I submit the city with Python and mechanize?</p>