用Python爬取http://133.2.190.11:7001/IRMS/index.jsp的信息
时间: 2023-10-10 22:14:38 浏览: 99
为了爬取该网站的信息,我们需要使用 `requests` 和 `BeautifulSoup` 库。以下是爬取该网站的基本步骤:
1. 发送 GET 请求获取网页内容
2. 使用 BeautifulSoup 解析 HTML
3. 找到需要的数据并提取
下面是示例代码:
```python
import requests
from bs4 import BeautifulSoup
url = "http://133.2.190.11:7001/IRMS/index.jsp"
# 发送 GET 请求
response = requests.get(url)
# 解析 HTML
soup = BeautifulSoup(response.content, "html.parser")
# 找到需要的数据并提取
table = soup.find("table", {"class": "table1"})
rows = table.find_all("tr")
for row in rows:
cols = row.find_all("td")
for col in cols:
print(col.text.strip(), end="\t")
print()
```
这段代码会输出该网站中的表格数据。你可以根据需要修改代码以获取你所需的数据。注意,由于该网站是内部网站,可能需要 VPN 或者其他特殊网络设置才能访问。
阅读全文
相关推荐














