如何从BeautifulSoup输出中取消特殊字符?

Suh*_*ail 4 python beautifulsoup utf-8 character-encoding special-characters

我面临着像°和®这样的特殊字符的问题,这些字符代表了华氏度符号和注册符号,

当我打印包含特殊字符的字符串时,它给出如下输出:

Preheat oven to 350° F
Welcome to Lorem Ipsum Inc® 
Run Code Online (Sandbox Code Playgroud)

有没有办法可以输出确切的字符,而不是他们的代码?请告诉我.

jfs*_*jfs 8

$ python -c'from BeautifulSoup import BeautifulSoup
> print BeautifulSoup("""<html>Preheat oven to 350&deg; F
> Welcome to Lorem Ipsum Inc&reg;""",
> convertEntities=BeautifulSoup.HTML_ENTITIES).contents[0].string'
Preheat oven to 350° F
Welcome to Lorem Ipsum Inc®
Run Code Online (Sandbox Code Playgroud)