Pythonいじっていてあれこれどう書くんだっけ?ってことがよくありますよね。 僕もそんなわけなんでググるんですけど欲しい情報がなかなか出てこなかったり、 というかそこに時間を割きたくないので自分のブログをノート代わりに残そうと思います。 Pythonフォルダにたくさん入れておくのも嫌なので。 今回はBeautifulSoupとRequestsについてです。 BeautifulSoupの使い方 1.まずはインポート 2.ソースを打ち込む 3.スープを作る 4.スープから要素を取り出す。 User-Agentを偽装する 実践 まとめ BeautifulSoupの使い方 htmlから情報を引き出すモジュールです。 urlからじゃなくてhtmlからってところが肝です。 1.まずはインポート from bs4 import Beautifulsoup 現在はBeautifulSopu4.2とかが出