摘要:
匹配模式 从字符串中全部查找内容,返回一个列表 import re s = "hello_宇霖_hello" print(re.findall("hello", s)) \w 查找字母(包含中文)或数字或下划线 import re s = "hello_宇霖_hello" print(re.find 阅读全文
摘要:
1、namedtuple:生成可以使用名字来访问元素内容的tuple 第一个参数的元组的名字,第二个参数是元组中元素的[名字, 名字] from collections import namedtuple Point = namedtuple("Point", ["x", "y"]) p = Poi 阅读全文
摘要:
os 模块:程序员通过python向操作系统发送指令(与操作系统交互的接口) os模块四组: 1、工作目录 当前工作路径:os.getcwd() import os print(os.getcwd()) 路径切换:os.chidr() import os os.chdir("/usr") print 阅读全文