如何获取网页中的特定值?
我在网站中有一些
和其他内容,以及无数 div 中间的特定行<input name="extWarrantyProds" type="hidden" value="23814298 ^ true"/>
如何从这段代码中获取位于中间的“值”部分一个有其他东西的网站?
我正在尝试使用 urllib 但我什至不知道从哪里开始=/
I have some <div>
s and other stuff in a site and the specific line in the middle of inumerous divs
<input name="extWarrantyProds" type="hidden" value="23814298 ^ true"/>
How can I get the "value" part from this code, which it is in the middle of a site with other stuff ?
I'm trying with urllib but I don't even know where to start =/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我能想到的最简单的方法:
The easiest way I can think of:
如果这就是您所需要的,则无需任何太花哨的东西。使用
urllib
下载页面并使用re.findall()
查找值。No need for anything too fancy if that's all you need. Download the page using
urllib
and look for the value usingre.findall()
.