[Tutor] Spanish text in BS problem
Ismael Garrido
ismaelgf at adinet.com.uy
Wed Nov 9 04:20:17 CET 2005
Hello
I'm using Beautiful Soup to scrape a site (that's in Spanish) I
sometimes come across strings like:
'Ner\\xf3n como cantor'
Which gets printed:
Ner\xf3n como cantor
When they should be:
Nerón como cantor
I don't know if it is my fault (due to me misusing BS) or is it a BS
fault. Anyway, is there a way to print the string correctly?
This is the code I'm using in BS
a = open("zona.htm")
text = a.readlines()
a.close()
BS = BeautifulSoup.BeautifulSoup(str(text))
for ed in BS('span', {'class':'ed_ant_fecha'}):
urlynombre = ed.findNextSibling().findNextSibling().findNextSibling()
nombre = urlynombre.next.next
And "nombre" is that string I mentioned.
Any help is appreciated, thanks
Ismael
More information about the Tutor
mailing list