1
我已經在記事本中保存了包含ANSI編碼列表的文本文件。嘗試從文本文件打印簡單列表時出現「輸出不是utf-8」錯誤
當我嘗試使用Python中的下面的腳本顯示列表時,它顯示列表中的第一項,然後給出「output not utf-8」錯誤消息。
with open("animals.txt") as f:
content = f.readlines()
for animal in content:
print animal
有沒有辦法解決這個問題?
舌頭在臉頰答案 - 使用Python 3! – rlms
我們需要看'animals.txt'來查看真正發生了什麼。 –
我正在使用Python 2.7。將更改爲Python 3解決問題? – bolshevik