Home > Article > Backend Development > Pandas can directly read web page html (table), json, csv and other formats
I asked a question in the Python Silver Exchange Group [Ming] a few days ago Pandas
handles the problem of html
, as shown in the figure below.
In fact, it’s not a question, it’s an exchange.
Indeed, Pandas
can read html
directly, and it is more convenient when reading web pages.
Let’s discuss it together and learn how to read html
directly from Pandas
method.
Later [null] gave a sample code, which was just in time.
A simple three-sentence code can extract web page data and save it in a table. For web pages in tabular form, you no longer need to tr
, td
one by one. I went to pick up the tag, just Pandas
.
Later I found out that the brothers were fellow policemen in Hubei Province, and they chatted animatedly with each other. It’s more fun to meet fellow villagers and study together! Later, [null] was expanded to include the json
format loaded by ajax
, which can also be implemented using Pandas
. An example is also given here.
The result obtained is shown in the figure below:
Later [Moon God] also provided extensions, and it is also possible to capture the csv
format.
I have to admit, Pandas
is really too powerful!
The above is the detailed content of Pandas can directly read web page html (table), json, csv and other formats. For more information, please follow other related articles on the PHP Chinese website!