HTTPライブラリRequestsを利用してhtmlを取得するpythonプログラム
・エンコーディングに注意
python 3.6.2
requests 2.18.4
beautifulsoup4 4.6.0
chardet 3.0.4
※スタートメニュー>Anaconda3(64-bit)>Anaconda Navigator>Environments>installed で確認
※すべてAnacondaに同梱されており改めてインストールする必要はなし
RequestsとBeautiful Soupでのスクレイピング時に文字化けを減らす
http://orangain.hatenablog.com/entry/encoding-in-requests-and-beautiful-soup
import requests
from bs4 import BeautifulSoup
r = requests.get("http://tadashi0vi.html.xdomain.jp/test014.html")
soup = BeautifulSoup(r.content, 'html.parser')
print(soup)
当該ページのhtmlが出力される