一、collections模块1.函数namedtuple(1)作用:tuple类型,是一个可命名的tuple(2)格式:collections(列表名称,列表)(3)返回值:一个含有列表的类(4)例子:importcollections#help(collections.namedtuple)Point=collections.namedtuple("Point",['x','y'])p=Point(15,45)print(p.x+p.y)print
系统 2019-09-27 17:45:52 2165
Python可以使用xml.etree.ElementTree模块从简单的XML文档中提取数据。为了演示,假设你想解析PlanetPython上的RSS源。下面是相应的代码:fromurllib.requestimporturlopenfromxml.etree.ElementTreeimportparse#DownloadtheRSSfeedandparseitu=urlopen('http://planet.python.org/rss20.xml')
系统 2019-09-27 17:38:13 2165