我正在尝试在Python中读取一个URL,但它只读取了部分内容。

2024-04-24 21:59:32 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图在python3中读入一个url,但是当我尝试时,它并没有在url中完全变红 这是我的密码

my_url="https://www.newegg.ca/Video-Cards-Video-Devices/Category/ID-38?Tpk=graphics%20cards"

Uclient=uReq(my_url)

page_html=Uclient.read()

Tags: httpsidurl密码mywwwvideopython3
1条回答
网友
1楼 · 发布于 2024-04-24 21:59:32

你试过用requests导入它吗?由于您没有显示直接导入,我假设您使用的是urllib.request。下面的代码应该在加载任何javascript之前为您提供完整的html文本(如果是这样的话)

import requests

my_url="https://www.newegg.ca/Video-Cards-Video-Devices/Category/ID-38?Tpk=graphics%20cards"
r = requests.get(my_url)
print (r.text)

相关问题 更多 >