python - Python 数据抓取从表中返回空值
问题描述
我正在尝试从网站上抓取数据,但不是使用表中包含的数据打印输出,而是返回一个空字符串。该网站试图从http://tfda.go.tz/portal/registered-products/registered-drug-products-1
这是我用于抓取的代码
from bs4 import BeautifulSoup
import requests
import sys, io
page = requests.get("http://tfda.go.tz/portal/registered-products/registered-drug-products-1")
soup = BeautifulSoup(page.content, 'html.parser')
sys.stdout = io.TextIOWrapper(sys.stdout.buffer,'cp437','backslashreplace')
#print(soup.prettify())
simple = list(soup.children)
#print(simple)
#S/n = ""
Certificate = ""
Brandname = ""
#Classfication Name = ""
#Dosage Form = ""
#Product Strength = ""
Registrant = ""
#Registrant Country = ""
Manufacturer = ""
#Manufacturer Country = ""
#Expiry Date = ""
table = soup.find("table", { "class" :"table table-stripped table_productDrugs" })
print (table)
这是我的输出截图示例输出
我感谢您的帮助
解决方案
推荐阅读
- ios - 如何使用指定的 shell 命令和配置文件构建 iOS 应用程序扩展
- javascript - 查找所需的对象属性并将其替换为与对象数组相关的值
- excel - VBA Excel目标搜索循环在命名范围内
- java - kotlin 中是否有任何方法可以在“Int”中的特定索引处获取数字?
- c# - asp.net core 3.1 HttpClient,Json序列化两次
- javascript - 按键 UI5 从 flexbox 中删除项目
- r - 如何调用列表元素来计算新的 data.frame 列
- javascript - 如何使用节点和 json 发送 Walmart API Update Bulk Inventory 请求?
- node.js - 如何配置 WebRTC 以连接到我的 TURN 服务器?
- python - 如何在 Django 模型中将 ManyToManyFields 的选择限制为仅特定的外键