擅长:python、mysql、java
<p>我想这就是你想要的:</p>
<pre><code>import requests as r
res = r.get('https://www.cbn.gov.ng/rates/outputExchangeRateJSN.asp')
if res.status_code == 200:
data = res.json()
# Do something with the data
else:
print(f"Error: {res.status_code}")
</code></pre>
<p>您将以<code>JSON</code>的形式获取数据,并从中提取您需要的内容</p>
<p>这是因为请求是动态发出的,以填充页面的主体,这就是为什么您无法从第一个页面中找到内容</p>
<p>您也可以使用此链接将其作为<code>CSV</code>文件下载,所有内容:<a href="https://www.cbn.gov.ng/Functions/export.asp?tablename=exchange" rel="nofollow noreferrer">CSV_File</a></p>