#! /usr/bin/python
# coding: utf-8
from pyquery import PyQuery c=PyQuery('http://news.dbanotes.net/') titles=c.find('.title') for t in titles:
title=c(t).find('a')
t1=title('a').text()
h1=title('a').attr('href')
if t1!=None:
print t1,'\n\t',h1
2023-10-06 09:20:34
#! /usr/bin/python
# coding: utf-8
from pyquery import PyQuery c=PyQuery('http://news.dbanotes.net/') titles=c.find('.title') for t in titles:
title=c(t).find('a')
t1=title('a').text()
h1=title('a').attr('href')
if t1!=None:
print t1,'\n\t',h1
下一篇:coursea机器学习课程作业