简体   繁体   中英

Python Encode Ã3 as ó

I have a string like

' La empresa de capitales mixtos que opera el predio de residuos, Ceamse, aclarÃ3 este martes que la responsabilidad del desentendimiento con los recicladores informales que provocÃ3 un nuevo bloqueo y hace peligrar la recolecciÃ3n '

and y need this

' La empresa de capitales mixtos que opera el predio de residuos, Ceamse, aclaró este martes que la responsabilidad del desentendimiento con los recicladores informales que provocó un nuevo bloqueo y hace peligrar la recolección '

how can I do this with Python?

thanks!

You need to fix your webscraping script!

It looks like La Capital sends proper http header and html head information, and the content is UTF-8 encoded. So your script needs to handle that, and everything will work fine.

I know from experience requests.get and beautifulsoup 4 both handles Unicode well, so just debug your script, and see where it goes wrong. Check the raw input, check if you need your page's.content or.text, and fix it accordingly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM