Python代码不会返回任何内容

时间:2017-01-10 22:26:19

标签: python

我试图在Pycharm中运行此代码,但每当我尝试运行代码时,我的shell都没有任何输出。

import bs4
import requests

url = "https://www.indeed.com/jobs?q=python&l=Chicago%2C+IL, https://www.indeed.com/jobs?q=java&l=Chicago%2C+IL, https://www.indeed.com/jobs?q=javascript&l=Chicago%2C+IL, https://www.indeed.com/jobs?q=c%23&l=Chicago%2C+IL, https://www.indeed.com/jobs?q=php&l=Chicago%2C+IL, https://www.indeed.com/jobs?q=c%2B%2B&l=Chicago%2C+IL, https://www.indeed.com/jobs?q=sql&l=Chicago%2C+IL, https://www.indeed.com/jobs?q=ruby&l=Chicago%2C+IL, https://www.indeed.com/jobs?q=perl&l=Chicago%2C+IL, https://www.indeed.com/jobs?q=visual+basic&l=Chicago%2C+IL, https://www.indeed.com/jobs?q=.net&l=Chicago%2C+IL, https://www.indeed.com/jobs?q=python&l=Chicago%2C+IL, https://www.indeed.com/jobs?q=r&l=Chicago%2C+IL, https://www.indeed.com/jobs?q=swift&l=Chicago%2C+IL"

urls = [url]
visited = [url]

while len(urls) >0:
    try:
        htmltext = requests.get(urls[0])
    except:
        print (urls[0])
    tags = bs4.BeautifulSoup(htmltext.content, 'lxml')
    urls.pop(0)
    for tag in tags.select('#searchCount'):
        tag = (str(tag[0].getText()))
        print (tag)

1 个答案:

答案 0 :(得分:0)

我不知道你想要什么作为你的输出。 但我试图纠正你的代码

wp-load.php