Python Forum

Full Version: how to iterate through a divs tag
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi
i would like to get an idea on how can i iterate through DIVs in code to get some data from each DIV.
my example is an amazon page results and would like to get some information from each item an store it in data structure (each item is contained in a div tag) ....the link below results items from Amazon
try this method

You can loop through inner divs using jQuery .each() function. The following example does this, and for each inner div, it gets the id attribute.

$('#test').find('div').each(function(){
var innerDivId = $(this).attr('id');
});
@LeanbridgeTech, this is python forum and OP is asking for python solution.