04 2021 档案
摘要:# 捕获异常,异常之后,代码不再执行 try : a = 1/0 except ZeroDivisionError as e : print('出异常了,原因:',e) except IOError as e: print('IO异常,原因:', e) except ValueError as e:
阅读全文
摘要:# re 正则表达式 import re import requests with open('youdao.html',encoding='utf-8',mode='r') as f: date = f.read() pattren = re.compile('翻译') # 输入要匹配的内容 r1
阅读全文
摘要:# unittest 单元测试框架(必须使用类去做) import unittest class TestFuncation(unittest.TestCase): @classmethod def setUpClass(cls): print('\n************整个类最开始执行****
阅读全文
摘要:一:准备工作(创建数据库) 二:在python中连接数据库并操作 pip install pymysql # 安装第三方库 # 连接mysql数据库,做数据库存储 import pymysql # 连接数据库 connection_fanmao = pymysql.Connection( host=
阅读全文
摘要:一:说明 使用pytest 框架的时候,我们可以对测试结果,生成测试报告 支持的第三方插件有很多,我们以 pytest-html 为例说明 二:pytest-html pip install pytest-html # 安装第三方库 # test_case1.py文件 def test_case01
阅读全文
摘要:一:使用说明 (1)初次运行配置用户信息(在 cmd 里运行或在git bash中) git config --global user.name "用户名" git config --global user.email 邮箱地址 (2)pycharm中配置git 打开pycharm >找到setti
阅读全文