2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[python] htmlファイルを読み込んでスクレイピング練習

Last updated at Posted at 2020-02-20

はじめに

スクレイピングやってて躓いたときにcopy outerHTMLで要素解析すること多いと思うんだけど忘れていたのでメモ

参考

Python2年生 スクレイピングのしくみ 体験してわかる!会話でまなべる!

やりかた

コピーしてきたHTMLでファイルを作って読み込む

from bs4 import BeautifulSoup

with open('copy.html', encoding='utf-8') as f:
    html = f.read()

soup = BeautifulSoup(html, 'html.parser')
2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?