摘要: # 捕获异常,异常之后,代码不再执行 try : a = 1/0 except ZeroDivisionError as e : print('出异常了,原因:',e) except IOError as e: print('IO异常,原因:', e) except ValueError as e: 阅读全文
posted @ 2021-04-15 16:00 Z_sun 阅读(60) 评论(0) 推荐(0) 编辑
摘要: # re 正则表达式 import re import requests with open('youdao.html',encoding='utf-8',mode='r') as f: date = f.read() pattren = re.compile('翻译') # 输入要匹配的内容 r1 阅读全文
posted @ 2021-04-15 15:57 Z_sun 阅读(80) 评论(0) 推荐(0) 编辑