1

re.compile を使用して Web ページの値を一致させようとしています

私の Web ページには、次の HTML が含まれています。

<div id="paginate">
&nbsp;<strong>1</strong>
&nbsp;<a href="http://www.link2.com/">2</a>
&nbsp;<a href="http://www.link3.com/">3</a>
&nbsp;<a href="http://www.link2.com">&gt;</a>
&nbsp;&nbsp;<a href="http://www.link20.com/">Last &rsaquo;</a>
</div>

私の正規表現は次のとおりです。

re.compile('<a href="(.+?)">&gt;</a>').findall()

これは戻ります

['http://www.link2.com/">2</a>
&nbsp;<a href="http://www.link3.com">3</a>
&nbsp;<a href="http://www.link2.com/']

ラベルとして大なり記号を含むリンクの href のみを取得したいですか?

何か案は?

前もって感謝します

4

1 に答える 1