1
4

2 に答える 2

2

試す

data=[b.string for b in main_div.findAll('b')]
于 2013-03-21T04:08:50.913 に答える
2

たぶん、このようなものですか?

import BeautifulSoup

html = '''<div class="txt"><br> 
\nPower: <b>On</b><br><br>
\nSource: <b>DVI</b><br><br>
\nLamp runtime: <b>396</b> hours<br>
\nLamp remaining: <b>2035</b> hours<br>
\nTotal operation: <b>2551</b> hours<br>
\n</div>'''

soup = BeautifulSoup.BeautifulSoup(html)
bTags = [] 

for i in soup.findAll('b'):
    bTags.append(i.text)

bTag の内容:

[u'On', u'DVI', u'396', u'2035', u'2551']
于 2013-03-21T05:12:23.640 に答える