一直沒有辦法read html檔

看板Python作者時間13年前 (2012/12/03 02:20), 編輯推噓1(102)
留言3則, 2人參與, 最新討論串1/2 (看更多)
各位大大 幫忙一下了 目前一直卡在這個檔沒法子讀 http://www.cmlab.csie.ntu.edu.tw/~left/index813.html with open('index813.html','r') as page: for each_line in page: print(each_line.strip()) 出現下面error 一直處理不掉 UnicodeDecodeError: 'cp950' codec can't decode bytes in position 1256-1257: illegal multibyte sequence args = ('cp950', b'50"> 6/19</td>\n<td width="120">toughroleX</td...</div>\n</div>\n</div>\n</div>\n</body>\n</html>', 1256, 1258, 'illegal multibyte sequence') encoding = 'cp950' end = 1258 object = b'50"> 6/19</td>\n<td width="120">toughroleX</td...</div>\n</div>\n</div>\n</div>\n</body>\n</html>' reason = 'illegal multibyte sequence' start = 1256 with_traceback = <built-in method with_traceback of UnicodeDecodeError object> -- -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.217.224

12/03 11:48, , 1F
應該不是不能讀,是不能 print
12/03 11:48, 1F

12/03 12:02, , 2F
抱歉誤導,是不能讀沒錯 XD
12/03 12:02, 2F

12/05 10:40, , 3F
奇怪~我可以讀勒~沒有特別處理編碼
12/05 10:40, 3F
文章代碼(AID): #1GkvlJ1K (Python)
討論串 (同標題文章)
文章代碼(AID): #1GkvlJ1K (Python)