簡體   English   中英

如何使用 Python 從 html 中獲取數據

[英]How to get data from html with Python

我想用 Python 獲得與圖片相同的文本。 有沒有人有想法?

在此處輸入圖片說明

你可以試試html2textBeautifulSoup 之類的工具

我知道在 html 中使用正則表達式可能不是最好的方法,但您可以這樣做:

import re

code_search = re.search('>\n?" Security code: "\n?<[^<>]+>\n?(\d*)\n?<', html)
if code_search:
    print(code_search.group(1))

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM