1
美丽的汤似乎无法正常工作(对我来说),如果HTML包含Unicode的ASCII超过128.什么合适的解码编码应该用于此?通过美丽的汤解析HTML与Unicode的问题
raw = open('index.html').read()
BeautifulSoup.BeautifulSoup(raw)
错误
...stacktrace...
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 8094: ordinal not in range(128)
如果您不能使用** print **语句,您将如何解决此问题? (在这里看到更多:http://stackoverflow.com/questions/7769745/python-convert-and-save-unicode-string-to-a-list) –
你不需要,这是整个点。当您在控制台中输出时,这只是一个问题。 –