title: associative list python
body: <p>i am parsing some html form with Beautiful soup. Basically i´ve around 60 input fields mostly radio buttons and checkboxes. So far this works with the following code:</p>
  
  <pre><code>from BeautifulSoup import BeautifulSoup
  x = open('myfile.html','r').read()
  out = open('outfile.csv','w')
  soup = BeautifulSoup(x)
  values = soup.findAll('input',checked="checked")
  # echoes some output like ('name',1) and ('value',4)
  
  for cell in values:
  # the following line is my problem! 
      statement = cell.attrs[0][1] + ';' + cell.attrs[1][1] + ';\r'
      out.write(statement)
  
  out.close()
  x.close()
  </code></pre>
  
  <p>As indicating in the code my problem ist where the attributes are selected, because the HTML template is ugly, mixing up the sequence of arguments that belong to a input field. I am interested in name="somenumber" value="someothernumber" . Unfortunately my attrs[1] approach does not work, since name and value do not occur in the same sequence in my html. </p>
  
  <p>Is there any way to access the resulting BeautifulSoup list associatively?</p>
  
  <p>Thx in advance for any suggestions!</p>