1 import requests 2 import pandas as pd 3 4 url = 'https://www.accessdata.fda.gov/scripts/cdrh/cfdocs/cfpma/pmamemos.cfm' 5 param = { 6 "start_search": 1, 7 "device": "", 8 "sort": "ddd", 9 "pagenum": 500 10 } 11 r = requests.get(url, params=param) 12 data = pd.read_html(r.text)[2]
pd.read_html(r.text): 可以获取页面中所有的表格的列表,在列表中选择你需要的那个
此外,该url直接访问时:
选择一页显示500条数据时:网址改变了,多了载荷,可以发现拼在网址后面的正是载荷,所以写爬虫代码时可以可以传入载荷
标签:载荷,read,text,pands,url,html,pd From: https://www.cnblogs.com/avivi/p/17352743.html