2017-01-20 13 views
1
print(soup.table.thead.tr) 

<tr> 
<th scope="col"><span class="pl4">거래</span></th> 
<th scope="col">종류</th> 
<th scope="col">확인일자</th> 
<th scope="col"> <span class="blind">현장확인 사진</span></th> 
<th scope="col">매물명</th> 
<th scope="col"> 


         면적(㎡) 



     </th> 
<th scope="col">층</th> 
<th class="align_r" scope="col">매물가(만원)</th> 
<th scope="col">연락처</th></tr> 
In [ ]: 

私はこの結果をbeautifulSoupから得て、trタグの下にthタグの値を取得したいと考えています。このリストを取得する方法はありますか?私はfind_all()関数を使いたくありません。なぜなら、htmlは検索するには大きすぎるので、私は別の選択肢が必要です。 同じタグのタグを反復処理する方法は?

答えて

1

美しいスープは、膨大なデータのための発電機を持っています

Document

childGenerator() -> children 
nextGenerator() -> next_elements 
nextSiblingGenerator() -> next_siblings 
previousGenerator() -> previous_elements 
previousSiblingGenerator() -> previous_siblings 
recursiveChildGenerator() -> descendants 
parentGenerator() -> parents 

あなたはchildren発電機を使用することができます

for th in soup.table.thead.tr.children: 
    pass 
+1

を、あなたはより多くの説明を与えることはできますか?私はまだ理解できません。 – verystrongjoe

関連する問題