随笔分类 -  Python

摘要:pip install python-opencv:错误 pip install opencv-python:正确 翻译 搜索 复制 阅读全文
posted @ 2024-01-23 12:02 txwtech 阅读(20) 评论(0) 推荐(0)
摘要:翻译 搜索 复制 阅读全文
posted @ 2024-01-23 10:58 txwtech 阅读(18) 评论(0) 推荐(0)
摘要:在线深度学习 https://zh.d2l.ai/chapter_installation/index.html 阅读全文
posted @ 2024-01-13 14:04 txwtech 阅读(23) 评论(0) 推荐(0)
摘要:基本的序列和映射协议 类实例化当作字典使用,构造函数初始化参数 序列和映射基本上是元素(item)的集合,要实现它们的基本行为(协议),不可变对象需 要实现2个方法,而可变对象需要实现4个。  __len__(self):这个方法应返回集合包含的项数,对序列来说为元素个数,对映射来说 为键值对数 阅读全文
posted @ 2024-01-10 14:07 txwtech 阅读(31) 评论(0) 推荐(0)
摘要:55.system.exit()退出-不执行-所在函数方法后续代码,类似c# return 翻译 搜索 复制 阅读全文
posted @ 2024-01-09 13:24 txwtech 阅读(28) 评论(0) 推荐(0)
摘要:f __name__ == '__main__': print('test211') alist = [1,2,3,4,5,6,7,8,9] blist = list(filter((lambda x:x%2==0),alist)) print(blist) clist = list(map((la 阅读全文
posted @ 2024-01-09 08:42 txwtech 阅读(12) 评论(0) 推荐(0)
摘要:53.python类的继承与构造函数 # This is a sample Python script. # Press Shift+F10 to execute it or replace it with your code. # Press Double Shift to search ever 阅读全文
posted @ 2024-01-08 22:42 txwtech 阅读(32) 评论(0) 推荐(0)
摘要:pycharm社区版下载方法pycharm-community-2023.3.2.exe https://www.jetbrains.com.cn/ pycharm-community-2023.3.2.exe 阅读全文
posted @ 2024-01-08 21:36 txwtech 阅读(351) 评论(0) 推荐(0)
摘要:52.python收集参数 def print_params(*params): # *接受元组,一个星号 print(params) def print_params2(tt2, *params): # *接受元组 print(tt2) print(params) def print_params 阅读全文
posted @ 2024-01-07 21:35 txwtech 阅读(22) 评论(0) 推荐(0)
摘要:employee就是包 导入包,使用时默认调用__init__.py文件 class Employee: __wwid = '' # 两个__下划线表示private私有变量 __name = '' wwid = 'cd987' # public公有变量 def set_wwid(self, wwi 阅读全文
posted @ 2024-01-07 21:18 txwtech 阅读(34) 评论(0) 推荐(0)
摘要:50.读取ini配置文件与使用日志模块logging记录日志信息保存日志文件 dept.ini [robots] fxl: L223 ttw: L856 ssy: M398 result_msg: this is ini file pii:3.625412 [visions] ll:k566 zel 阅读全文
posted @ 2024-01-04 16:49 txwtech 阅读(118) 评论(0) 推荐(0)
摘要:mail_list = '123<aa2@163.com>acdef, 123123;<ba1@qq.com>acdef,;w8<aah@163.com>acdef,;dtg<ca@186.com>acdef,;jjdtg<qd@163.com>acdef,;jjtr' print('提取所有邮件地 阅读全文
posted @ 2024-01-04 14:33 txwtech 阅读(336) 评论(0) 推荐(0)
摘要:Python 正则表达式(RegEx) 在本教程中,您将学习正则表达式(RegEx),并使用Python的re模块与RegEx一起使用(在示例的帮助下)。 正则表达式(RegEx)是定义搜索模式的字符序列。 例如, ^a...s$ 上面的代码定义了RegEx模式。模式是:以a开头并以s结尾的任何五个 阅读全文
posted @ 2024-01-04 10:49 txwtech 阅读(288) 评论(0) 推荐(0)
摘要:this = chr(ESCAPES[this][1])KeyError: '\\e' re.error: bad escape \e at position 7 错误 正确: 翻译 搜索 复制 阅读全文
posted @ 2024-01-04 09:05 txwtech 阅读(150) 评论(0) 推荐(0)
摘要:在Python中,脱字符号只在Windows的命令行shell中有效,如果在IDLE或其他文本编辑器中,脱字符号会被忽略,直接当成普通字符处理 要指定排除字符集,可在开头添加一个^字符,例如'[^abc]'与除a、b和c外的其他任何字符都匹配。 翻译 搜索 复制 阅读全文
posted @ 2024-01-04 08:51 txwtech 阅读(74) 评论(0) 推荐(0)
摘要:Python 获取当前时间 本文中,您将学习获取语言环境的当前时间以及Python中的不同时区。 您可以采用多种方法获取Python当前时间。 示例1:使用datetime对象的当前时间 from datetime import datetime now = datetime.now() curre 阅读全文
posted @ 2024-01-03 21:02 txwtech 阅读(176) 评论(0) 推荐(0)
摘要:Python Global 关键字 全局关键字简介 在Python中,global关键字允许您在当前作用域之外修改变量。它用于创建全局变量并在局部上下文中对该变量进行更改。 全局关键字规则 Python中global关键字的基本规则是: 当我们在函数内部创建变量时,默认情况下它是局部的。 当我们在函 阅读全文
posted @ 2024-01-03 20:58 txwtech 阅读(246) 评论(0) 推荐(0)
摘要:Python range() 使用方法及示例 range(start, stop[, step]) 中括号含义:[,step]是第三个参数,可选项 参考 range()参数 range()主要采用三个在两个定义中具有相同用法的参数: start -整数,从该整数开始返回整数序列 stop-要返回整数 阅读全文
posted @ 2024-01-03 20:52 txwtech 阅读(151) 评论(0) 推荐(0)
摘要:42.python json模块字符串操作_读取写入文件_对象转json字符串转对象相互转换 # This is a sample Python script. # Press Shift+F10 to execute it or replace it with your code. # Press 阅读全文
posted @ 2024-01-03 13:35 txwtech 阅读(59) 评论(0) 推荐(0)
摘要:python shelve模块写入dat文件保存数据库 # This is a sample Python script. # Press Shift+F10 to execute it or replace it with your code. # Press Double Shift to se 阅读全文
posted @ 2024-01-03 11:19 txwtech 阅读(41) 评论(0) 推荐(0)