1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] How to capture table from html and convert it to csv file? [closed]

Discussão em 'Python' iniciado por Stack, Setembro 13, 2024.

  1. Stack

    Stack Membro Participativo

    I have downloaded a lot of html files from the internet. I want to get some specific tables from them. However, the structure of the table in the HTML file is not exactly the same.

    [​IMG]

    [​IMG]

    As you can see from the two picture above, the first table headers is in <thead> and content in <tbody>, but the second table headers and content are both in <tbody>.

    So is there any universal method to extract table from html file, no matter what the structure is? So after that I can save it as csv file properly.

    I find a chrome extension called capture table. Well, it can get all the tables in a html file and can save as multiple file format. Unfortunately, it is closed source. So I can't learn from the code inside.

    Continue reading...

Compartilhe esta Página