Vorrei raschiare un tavolo dal web e mantenere il & nbsp; entità intatte in modo che io possa ripubblicare come HTML in seguito. Tuttavia, BeautifulSoup sembra convertirli in spazi. Esempio:Raschiare utilizzando Beautiful Soup preserving entità
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
risultato osservato:
<td> hello </td>
risultato richiesto:
<td> hello </td>
Grazie per la risposta :) –