摘要: sys 模块:和Python解释器打交道的模块 sys模块是与python解释器交互的一个接口 阅读全文
posted @ 2019-04-17 22:55 LXL_1 阅读(93) 评论(0) 推荐(0) 编辑
摘要: os 模块: 和操作系统打交道的模块 os模块是与操作系统交互的一个接口 注意:os.stat('path/filename') 获取文件/目录信息 的结构说明 阅读全文
posted @ 2019-04-17 22:52 LXL_1 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 练习:生成随机验证码 阅读全文
posted @ 2019-04-17 22:51 LXL_1 阅读(127) 评论(0) 推荐(0) 编辑
摘要: time 模块: Eva_J 时间模块 和时间有关系的我们就要用到时间模块。在使用模块之前,应该首先导入这个模块。 表示时间的三种方式 在Python中,通常有这三种方式来表示时间:时间戳、元组(struct_time)、格式化的时间字符串: (1)时间戳(timestamp) :通常来说,时间戳表 阅读全文
posted @ 2019-04-17 22:50 LXL_1 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 返回顶部 模块的导入和使用 模块的导入应该在程序开始的地方 常用模块 collections模块 在内置数据类型(dict、list、set、tuple)的基础上,collections模块还提供了几个额外的数据类型:Counter、deque、defaultdict、namedtuple和Orde 阅读全文
posted @ 2019-04-17 22:48 LXL_1 阅读(209) 评论(0) 推荐(0) 编辑
摘要: # 正则表达式# 字符组 [字符]# 元字符 # \w \d \s # \W \D \S # . 除了换行符以外的任意字符 # \n \t # \b # ^ $ 匹配字符串的开始和结束 # () 分组 是对多个字符组整体量词约束的时候用的 #re模块:分组是有优先的 # findall ... 阅读全文
posted @ 2019-04-17 18:54 LXL_1 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 题目:暂停一秒输出 程序分析:使用 time 模块的 sleep() 函数。 阅读全文
posted @ 2019-04-17 15:18 LXL_1 阅读(215) 评论(0) 推荐(0) 编辑
摘要: 原文:https://baijiahao.baidu.com/s?id=1616207956596122967&wfr=spider&for=pc 原文:https://baijiahao.baidu.com/s?id=1616207956596122967&wfr=spider&for=pc 科技 阅读全文
posted @ 2019-04-17 12:01 LXL_1 阅读(2959) 评论(0) 推荐(0) 编辑
摘要: import re from urllib.request import urlopen def getPage(url): response = urlopen(url) return response.read().decode('utf-8') def parsePage(s): ret = re.findall( '.*?.*?(?P\d+).... 阅读全文
posted @ 2019-04-17 00:47 LXL_1 阅读(160) 评论(0) 推荐(0) 编辑
摘要: re模块下的常用方法 注意: 1 findall的优先级查询: 2 split的优先级查询 综合练习与扩展 1、匹配标签 import re ret = re.search("<(?P<tag_name>\w+)>\w+</(?P=tag_name)>","<h1>hello</h1>") #还可以 阅读全文
posted @ 2019-04-17 00:36 LXL_1 阅读(195) 评论(0) 推荐(0) 编辑