前景提要
HDC调试需求开发(15万预算),能者速来!>>> from bs4 import BeautifulSoup import requests url = "http://wh.xiaozhu.com/fangzi/2600993863.html" source_code = requests.get(url) soup = BeautifulSoup(source_code.text, 'lxml') Title = soup.select('body > div.wrap.clearfix.con_bg.cye-lm-tag > div.con_l.cye-lm-tag > div.pho_info.cye-lm-tag > h4 > em') print(Title)
selector参数,是直接copy的url页面中标题“2分钟直达地铁口君尚公寓 ”的selector,不知为何打印结果为空,求指教,新人刚学习,请轻拍。。
以下是运行结果:
D:\Tools\Anaconda3\python.exe C:/Users/Administrator/PycharmProjects/untitled/xiaozhu.py [] Process finished with exit code 0