python - About beautifulsoup getting document content
给我你的怀抱
给我你的怀抱 2017-06-22 11:52:13
0
1
633

The obtained data is saved locally and we plan to use beautifulsoup to parse the data, as shown in the figure:

<p><strong>释名</strong><br/>人龙。</p><p><strong>气味</strong><br/>大寒。</p><p><strong>主治</strong><br/>多年风眼。用蛔虫五条,晒干,研为末,加腻粉一钱、石胆半钱,共研为末点眼。每日二、三次。<br/>一切冷瘘。和人吐蛔虫烧灰涂搽。涂前以甘草汤洗净患处。<br/>小儿赤眼(胎赤眼或风赤眼)。用小儿吐出的蛔虫二长,装磁盒中,纸封好,埋湿地内。过五天取出,收存汁水。每日以箸蘸汁点眼。此方名“玉箸煎”。</p>

My code is as follows:

for i in soup.find_all('strong'):
    print(i.string)

But the output is:
release name
odor
attending

But the following content is not output. I know it is a problem with my code, but I don’t know how to solve it.
In addition, I would like to ask if it is not possible to parse the saved text file using beautifulsoup. I have seen online tutorials that extract tags from the source code to obtain the desired content.

给我你的怀抱
给我你的怀抱

reply all(1)
洪涛

Because the part you are looking for is the strong tag (soup.find_all('strong')), so the part without the emphasis tag will not be traversed. Among them, there are only Names Smell Indications It has the tag strong.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!