Monday, 9 September 2013

How to parse HTML string into HTML DOM elements in python?

How to parse HTML string into HTML DOM elements in python?

I've a string of HTML elements
HTMLstr =
<div class='column span4 ui-sortable' id='column1'></div>
<div class='column span4 ui-sortable' id='column2'>
<div class='portlet ui-widget ui-widget-content ui-helper-clearfix
ui-corner-all' id='widget_basicLine'>
<div class='portlet-header ui-widget-header ui-corner-all'><span
class='ui-icon ui-icon-minusthick'></span>Line Chart </div>
<div class='portlet-content' id=basicLine style='height:270px; margin:
0 auto;'></div>
</div>
</div>
<div class='column span4 ui-sortable' id='column3'></div>
I want to convert the above HTML string into respective HTML DOM elements
in python?
I can do it in jQuery/AJAX function via $(this).html(HTMLstr); but how do
I parse it in python?

No comments:

Post a Comment