KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm using PyQuery and want to print a list of links, but can't figure out how to get the href attribute from each link in the PyQuery syntax. This is my code: e = pq(url=results_url) links = e('li.moredetails a') print len(links) for link in links: print link.attr('href') This prints 10 , then gives the following error: AttributeError: 'HtmlElement' object has no attribute 'attr' What am I doing wrong?
Tags (comma-separated)
Save Edits
Cancel