[問題] 為什麼可以assign但不能print出來
我用beautifulsoup的get_text()抓資料
想要print出來看對不對
print(trs[0].get_text().encode("UTF-8").decode("UTF-8"))
結果一直出現錯誤
UnicodeEncodeError: 'cp950' codec can't encode character '\u7c7b' in position
0: illegal multibyte sequence
但卻可以assign
a = trs[0].get_text().encode("UTF-8").decode("UTF-8")
但一樣不能把a print出來
想請問這中的原因是甚麼...?
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 36.233.83.112
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1454403535.A.206.html
→
02/02 17:09, , 1F
02/02 17:09, 1F
→
02/02 17:10, , 2F
02/02 17:10, 2F
所以裡面值應該沒問題 是print的問題嗎?
※ 編輯: peace9527 (36.233.83.112), 02/02/2016 17:12:03
→
02/02 17:59, , 3F
02/02 17:59, 3F
→
02/02 19:25, , 4F
02/02 19:25, 4F
推
02/02 22:41, , 5F
02/02 22:41, 5F
Python 近期熱門文章
PTT數位生活區 即時熱門文章