文章分类 - 代码实例
摘要:##常用字符串操作 # 去除空格 "test string ".strip() # 去除字符串前导、后缀的指定字符 " test string ".strip("-") # 子字符串出现次数 " test string ".count("-") # 子字符串首次出现的位置,返回结果为 Base 0,
阅读全文
摘要:通用的 try 语句 try: ... except Exception as r: print(r) 获取当前脚本所在路径及脚本名称 import sys # sys.path[0] 返回当前脚本所在路径,形如“c:\users\aa”,末尾不含反斜线 path = sys.path[0] # s
阅读全文

浙公网安备 33010602011771号