captianinsano95
New Member
This is the portion of html code that express the information that i want to extract from a webpage.My intention is to extract just the names and values between the b tags. the result i am expecting is a list something like this.. [On,DVI,396,2035,2551] \[code\] ... <div class="txt"><br> Power: <b>On</b><br><br>Source: <b>DVI</b><br><br>Lamp runtime: <b>396</b> hours<br>Lamp remaining: <b>2035</b> hours<br>Total operation: <b>2551</b> hours<br></div>...\[/code\]What i tried was\[code\]from bs4 import BeautifulSoupimport urllib2url='ip address here'html=urllib2.urlopen(url).read()soup=BeautifulSoup(html)main_div=soup.find("div",{"class":"txt"})data=http://stackoverflow.com/questions/15538986/main_div.findAll('b').text\[/code\]where did i went wrong? FYI, i am a beginner so please bear with me. Thanks for your help.