0
def getPlural():
plural = soup.find("span", class_="form-of lang-de plural-form-of")
if plural == None:
    return None
else:
    return plural.get_text()

問題は私のコードのこの部分にあるようです。Pyscripter はそれをうまく処理し、Python.exe は戻りますError: 'charmap' codec can't encode character \xe4 in position 9: character maps to undefined.

PyScripter と Python.exe は同じバージョン (3.3) を実行します。どうしてこれなの?これを解決するにはどうすればよいですか?

4

1 に答える 1

0

おそらく、次のようなものでうまくいくでしょう:

print plural.encode('utf-8')

また

print plural.prettify().encode('utf-8')

+ + + + + + ++ +++ + + + +_ 編集: これを試してください...

print plural.get_text().decode('string-escape')
于 2014-04-16T15:19:00.283 に答える