开:http://arithmetic.zetamac.com/game?key=96823302,我们需要将问题从problem
类的<span>
标记中解决。
它不断更新,如何每次使用BeautifulSoup / Python检索数据?
我知道它会像:
from bs4 import BeautifulSoup
soup = BeautifulSoup(requests.get("http://arithmetic.zetamac.com/game?key=96823302").content)
problem = soup.find("span",class_="problem") #Initial finding
a = True
while(a == True):
print problem
problem = soup.find("span",class_="problem")
//然后它会重新循环
但这仅打印出来:<span class="problem"></span>
而不是内部,如2 + 2
或2 x 2