随笔分类 -  python

摘要:import re s = 'hello123world' result = re.search(r'\d{3}',s).group() print(result) re模块有3种匹配方式 match 从头匹配 search 搜索 findall 查找所有,返回列表 re.match(pattern 阅读全文
posted @ 2024-11-07 16:12 xx_cnblog 阅读(30) 评论(0) 推荐(0)
摘要:列表 append和extend区别: 都表示添加 append添加整体 extend逐个添加 举例说明 比如添加一个字符串,append添加整个字符串(['hello']);extend逐个字母添加(['h', 'e', 'l', 'l', 'o']); 十进制到十六进制 format(s, '0 阅读全文
posted @ 2024-11-06 11:08 xx_cnblog 阅读(21) 评论(0) 推荐(0)
摘要:查询串口 from serial.tools.list_ports import comports(from serial.tools.list_ports_windows import comports) print(comports()) [<serial.tools.list_ports_co 阅读全文
posted @ 2024-11-06 11:06 xx_cnblog 阅读(68) 评论(0) 推荐(0)
摘要:参考https://www.cnblogs.com/-wenli/p/11261109.html pip install pyserial from serial import Serial(from serial.serialwin32 import Serial) 自动打开串口 ser = Se 阅读全文
posted @ 2024-11-01 09:49 xx_cnblog 阅读(29) 评论(0) 推荐(0)