[問題] 新手請教Beautiful Soup執行環境
各位版友大家好
最近再學習爬蟲,目前正在試著用 Beautiful Soup抓資料
如果我把下面的程式碼在virtual environment 或是
打開cmd,切到python目錄下執行,都會有問題
===============================================
import requests
from bs4 import BeautifulSoup
res = requests.get('http://www.google.com')
soup = BeautifulSoup(res.text,'html.parser')
===============================================
錯誤訊息:
UnicodeEncodeError: 'charmap' codec can't encode characters
可是如果我開啟python schell 一行一行把code寫進去,卻是沒有問題的
(也可以抓到我想要的資料)
請問各位版友,可以幫忙告訴我是什麼問題嗎?
google了好久都沒有頭緒
非常謝謝大家
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 125.227.157.49
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1490946101.A.31B.html
→
03/31 17:33, , 1F
03/31 17:33, 1F
→
04/02 00:44, , 2F
04/02 00:44, 2F
→
04/02 00:44, , 3F
04/02 00:44, 3F
→
04/02 09:21, , 4F
04/02 09:21, 4F
→
04/02 09:22, , 5F
04/02 09:22, 5F
Python 近期熱門文章
PTT數位生活區 即時熱門文章