
上QQ阅读APP看书,第一时间看更新
练习题
1.urllib库包含哪些主要模块?
2.给出URL解析的执行结果。
from urllib import parse
url=“http://www.baidu.com/s?username=Python”
result=parse.urlparse(url)
print("urlparse出来的结果:%s" % str(result))?'
3.利用request抓取新浪网站图标。
4.写出下列代码的执行结果。
from lxml import etree
html=etree.parse('test.html')
print (type(html))
result=html.xpath('//li/@class')
print (result)