|
bs4,这是选择题,现在是题目和选项分开的,怎样让题目和选项在一起。
from bs4 import BeautifulSoup
html = open("e://py/1.html", "rb")
bs = BeautifulSoup(html, "lxml")
timu = bs.find_all('code')
xianzhe = bs.find_all('label')
for tm in timu:
print(tm.text)
for xz in xianzhe:
print(xz.text)
|
|