python quick access to web content standard forms

from html_table_parser  import HTMLTableParser

def tableParse(value):
    p = HTMLTableParser()
    p.feed(value)
    print(p.tables)
import pandas as pd

def framParse(value):
        soup=BeautifulSoup(value, 'html.parser')
        tables = soup.select('table')
        print(tables)
        df_list = []
        for table in tables:
            print(pd.read_html(table.prettify()))
            df_list.append(pd.concat(pd.read_html(table.prettify())))
        df = pd.concat(df_list)
        df.to_excel('vscode快捷键大全.xlsx')

Above two methods are standard forms can be resolved

Guess you like

Origin www.cnblogs.com/jestin/p/11881557.html