随笔分类 -  Python常用模块

re模块
摘要:re模块 re模块提供了与 Perl 语言类似的正则表达式匹配操作 正则表达式 正则表达式(Regular Expression)是一种文本模式, 使用单个字符串来描述, 匹配一系列匹配某个句法规则的字符串. 普通字符 普通字符包括没有显式指定为元字符的所有可打印和不可打印字符. 这包括所有大写和小 阅读全文

posted @ 2021-09-02 10:53 MidSummer丶 阅读(112) 评论(0) 推荐(0)

time模块
摘要:time模块 graph LR A[Timestamp] -->|localtime/gmtime| B[struct time] B -->|strftime| C[format time] graph LR A[format time] -->|strptime| B[struct time] 阅读全文

posted @ 2021-08-03 15:21 MidSummer丶 阅读(47) 评论(0) 推荐(0)

random模块
摘要:random模块 random.random() 生成一个0到1的随机浮点数 >>> random.random() 0.9505298542730263 >>> random.random() 0.04196790936158523 random.uniform(a, b) 生成一个a到b的随机浮 阅读全文

posted @ 2021-07-07 15:32 MidSummer丶 阅读(91) 评论(0) 推荐(0)

os模块
摘要:os模块 os模块提供了用来处理文件和目录的方法 os.path 模块 os.path.abspath(path) 返回path的绝对路径 os.path.dirname(path) 返回文件路径, 简单来说就是返回当前文件所在目录 在脚本中os.path.dirname()和os.path.abs 阅读全文

posted @ 2021-07-07 14:59 MidSummer丶 阅读(50) 评论(0) 推荐(0)

导航