Remrinのpython攻略日記

python3に入門しました。python3についてあれこれとサンプルコードとか。

2017-05-01から1日間の記事一覧

BeautifulSoup4の使い方

htmlの構文解釈のライブラリです。 ○htmlの準備 # -*- coding: utf-8 -*- import urllib.request from bs4 import BeautifulSoup url = "http://python-remrin.hatenadiary.jp/" f = urllib.request.urlopen(url) html = f.read().decode('utf-8') soup = Be…

urllibライブラリの使い方

urllibはURLにアクセスするライブラリです。 urllibモジュールは、Python 3 で urllib.request, urllib.parse, urllib.error に分割されて名称変更されました。 ・urllib.request は URL を開いて読むためのモジュールです ・urllib.error は urllib.request…