title: Getting attributes in PyQuery?
body: <p>I'm using PyQuery and want to print a list of links, but can't figure out how to get the <code>href</code> attribute from each link in the PyQuery syntax. </p>
  
  <p>This is my code:</p>
  
  <pre><code>  e = pq(url=results_url)
    links = e('li.moredetails a')
    print len(links)
    for link in links:
      print link.attr('href')
  </code></pre>
  
  <p>This prints <code>10</code>, then gives the following error: </p>
  
  <pre><code>AttributeError: 'HtmlElement' object has no attribute 'attr'
  </code></pre>
  
  <p>What am I doing wrong?</p>