2018年1月7日

if __name__ = "main" 解释

摘要: 阅读全文

posted @ 2018-01-07 14:49 chungehpu 阅读(130) 评论(0) 推荐(0) 编辑

ConfigParser 模块

摘要: Python 读取写入配置文件很方便,可使用内置的 configparser 模块 该模块支持读取windows 下的 .conf 及 .ini 文件等。 [section1] option1 = "hello" option2 = "world" [section2] option3 = 111 阅读全文

posted @ 2018-01-07 14:45 chungehpu 阅读(97) 评论(0) 推荐(0) 编辑

map + filter + reduce

摘要: map 是对 集合 里面的元素一个接一个的进行某种运算,常常与lambda 结合使用 #求平方: items = [1, 2, 3, 4, 5] squared = list(map(lambda x: x**2, items)) 此外,map还可以对函数进行迭代运算: # def multiply 阅读全文

posted @ 2018-01-07 14:31 chungehpu 阅读(98) 评论(0) 推荐(0) 编辑

requests + BeautifulSoup + json

摘要: requests: response.text 以 unicode 格式显示响应的文本 response.content 以 二进制 格式显示响应的文本 BeautiSoup: soup = BeautifulSoup (response.text,解析方式) 常用的解析方式有 "html.pars 阅读全文

posted @ 2018-01-07 13:25 chungehpu 阅读(238) 评论(0) 推荐(1) 编辑

导航