简体   繁体   English

如何在Python中从网页获取更改信息

[英]How to get changing information from a webpage in Python

I am new with Python and am trying to create a program that will read in changing information from a webpage. 我是Python的新手,正在尝试创建一个程序来读取网页中不断变化的信息。 I'm not sure if what I'm wanting to do is something simple or possible but in my head it seems do-able and relatively. 我不确定我想做的事情是否简单或可行,但在我看来似乎可行且相对。 Specifically I am interested in pulling in the song names from Pandora as they change. 我特别想从潘多拉(Pandora)的歌曲名称中更改歌曲名称。 I have tried looking into just reading in information from a webpage using something like 我试图研究使用类似的方法从网页中读取信息

import urllib
import re
page = urllib.urlopen("http://google.com").read()
re.findall("Shopping", page)
['Shopping']
page.find("Shopping")

However this isn't really what I'm wanting due to it getting information that doesn't change. 但是,这并不是我真正想要的,因为它获取的信息不会改变。 Any advice or a link to helpful information about reading in changing info from a webpage would be greatly appreciated. 任何建议或有关从网页中更改信息中读取有用信息的链接将不胜感激。

The only way this is possible (without some type of advanced algorithm) is if there are some elements of the page that do NOT change, which you can specify your program to look for. 唯一可行的方法(没有某种类型的高级算法)是页面中的某些元素没有更改,您可以指定要查找的程序。 Otherwise, I believe you will need some sort of advanced logic. 否则,我相信您将需要某种高级逻辑。 After all, computers can only do what we instruct them to do. 毕竟,计算机只能按照我们的指示去做。 Sorry :) 对不起:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM