7
웹에서 테이블을 긁어 내고 싶습니다. & nbsp; 엔티티가 그대로 유지되어 나중에 HTML로 다시 게시 할 수 있습니다. BeautifulSoup는 공간으로 변환하는 것 같습니다. 예 :아름다운 수프를 사용하여 긁어 내기 엔티티
from bs4 import BeautifulSoup
html = "<html><body><table><tr>"
html += "<td> hello </td>"
html += "</tr></table></body></html>"
soup = BeautifulSoup(html)
table = soup.find_all('table')[0]
row = table.find_all('tr')[0]
cell = row.find_all('td')[0]
print cell
관찰 결과 :
<td> hello </td>
필요한 결과 : BeautifulSoup로 생성자 BS4에
<td> hello </td>
감사합니다 :) –