摘要: 一,Python 字典映射,代替 switch Python中,没有switch,在别的语言中为 上例,在Python中,用字典映射 1)当day的值存在字典的key中时 2)当day的值不存在字典switcher中,而且要有默认真时。 3)当字典中的值为代码块的时候 二推导式 1) 2) 3)字典 阅读全文
posted @ 2018-07-17 19:33 annier 阅读(229) 评论(0) 推荐(1) 编辑
摘要: from urllib import requestclass Spider(): url='https://www.panda.tv/cate/lol' #目录地址 def __fetch__content(self): #定义私有方法,要取得页面内容 r=request.urlopen(Spid 阅读全文
posted @ 2018-07-17 12:41 annier 阅读(257) 评论(1) 推荐(0) 编辑