LoginSignup
0
1

More than 3 years have passed since last update.

BeautifulSoup .contents[ ]の使い方

Posted at

BeautifulSoup .contents[ ]の使い方

HTMLの取得したいタグのところで、'<'が何番出てくるかカウントするぽい。

例:

[<a href="https://jicpa.or.jp/news/information/2020/20200703iig.html">
 <em class="date">2020年07月03日</em>
 <div class="tag-outer"><span class="tag color-blue-01">お知らせ</span>
 </div>
 <p class="mod-sentence">修了考査受験者へ後進育成担当常務理事からのメッセージ動画公開</p>
 </a>, <a ・・・・]

こういった場合には、'<'だけを拾っていく。'</'は拾わない。
.contents[]でその数字を入れる。
あとは、属性を入力する。

属性は'text','string','strings'など

0
1
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
0
1