摘要: 日志作用: 调试 辅助定位问题 数据分析 日志的级别 五种日志级别按从低到高排序: DEBUG < INFO < WARNING < ERROR < CRITICAL 日志的用法: import logging logging.basicConfig(level=logging.DEBUG, for 阅读全文
posted @ 2022-04-30 18:27 lms21 阅读(35) 评论(0) 推荐(0)
摘要: 什么是正则表达式 正则表达式就是记录文本规则的代码 可以查找操作符合某些复杂规则的字符串 使用场景 处理字符串 处理日志 在 python 中使用正则表达式 把正则表达式作为模式字符串 正则表达式可以使用原生字符串来表示 原生字符串需要在字符串前方加上 r'string' # 匹配字符串是否以 ho 阅读全文
posted @ 2022-04-30 16:49 lms21 阅读(66) 评论(0) 推荐(0)
摘要: JSON JSON 是用于存储和交换数据的语法,是一种轻量级的数据交换格式。 使用场景 接口数据传输 序列化 配置文件 JSON 结构 键值对形式 数组形式 { "language": [ { "name": "python", "url": "https://www.python.org/" }, 阅读全文
posted @ 2022-04-30 16:24 lms21 阅读(99) 评论(0) 推荐(1)
摘要: math函数可以提供很多数学计算的帮助 数字常量: math.pi :圆周率 math.e :自然对数 math.inf :正无穷大,-math.inf 负无穷大 nath.nan:非数字 数论和表示函数:可百度 Python中处理时间的模块: time datetime 常见的时间表示形式: 时间 阅读全文
posted @ 2022-04-30 15:51 lms21 阅读(96) 评论(0) 推荐(0)
摘要: 读取方法: open() https://zhuanlan.zhihu.com/p/95989702 https://blog.csdn.net/liujingliuxingjiang/article/details/120744826 读操作: read() read(size) #读取指定字符 阅读全文
posted @ 2022-04-30 15:00 lms21 阅读(44) 评论(0) 推荐(0)
摘要: sys 概述 是 Python 自带的内置模块 是与 Python 解释器交互的桥梁 sys 使用 常用属性 常用方法 导入 sys 模块 # 导入sys模块 import sys # 查看sys模块帮助文档 help(sys) # 查看sys模块的属性和方法 print(dir(sys)) sys 阅读全文
posted @ 2022-04-30 11:19 lms21 阅读(61) 评论(0) 推荐(0)
摘要: os 概述 os: Operating System os 模块的常用功能 跨平台的差异 os 使用 导入 os 模块 查看 os 模块使用文档 help(os) dir(os) import os # 查看os模块说明文档 help(os) # 查看os模块的属性和方法 print(dir(os) 阅读全文
posted @ 2022-04-30 11:08 lms21 阅读(86) 评论(0) 推荐(0)
摘要: 语法错误:SyntaxError 逻辑错误:实现逻辑有问题 系统错误:由操作系统引起的问题 异常: 执行过程中出现的未知错误,且可以被捕获。 常见异常类型:除零异常,名称异常,索引异常,键异常,值异常,属性异常等 捕获异常: try: <command> except : <command> #if 阅读全文
posted @ 2022-04-30 10:02 lms21 阅读(45) 评论(0) 推荐(0)