Pythonを使用して次のスニペットから34980と100329を抽出するにはどうすればよいですか?
<tr id="product_34980" class="even">
<tr id="variant_100329" class="variantRow">
最も一般的な解決策ではありませんが、上記のスニペットで機能します。
import re
html = """
<tr id="product_34980" class="even">
<tr id="variant_100329" class="variantRow">
"""
ids = re.findall(r'id="\w+_(\d+)"', html)
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加