Iterate and extract tables from web saving as excel file in Python

后端 未结 1 1731
广开言路
广开言路 2021-01-28 12:31

I want to iterate and extract table from the link here, then save as excel file.

How can I do that? Thank you.

My code so far:

import p         


        
相关标签:
1条回答
  • 2021-01-28 13:12

    So, using the JSON API from XHR you make a simple python post request via requests and you have your data.

    In the params you have two of them which you can change to get different volumes of data, limit is the nos of objects you get in a request. pageNumber is the paginated page counter.

    from requests import post
    import json
    
    url = 'http://zjj.sz.gov.cn/projreg/public/jgys/webService/getJgysLogList.json'
    data = { 'limit' : '100', 'pageNumber' : '1'}
    response = post(url, data=d)
    response.text
    

    Further you can use pandas to create a data frame or create a excel as you want.

    0 讨论(0)
提交回复
热议问题