03 2022 档案

摘要:import mysql.connectordb_config = { 'host': 'xxxx', 'user': 'xxx', 'password': 'xxx', 'port': '3306', 'database': 'xxxx'}# 创建一个数据库连接conn = mysql.conne 阅读全文
posted @ 2022-03-31 17:20 狒狒桑 阅读(20) 评论(0) 推荐(0) 编辑
摘要:import logging# logging.debug('today-1')# logging.info('today-2')# logging.warning('today-3')# logging.error('today-4')# logging.critical('today-5')# 阅读全文
posted @ 2022-03-31 15:34 狒狒桑 阅读(13) 评论(0) 推荐(0) 编辑
摘要:import configparsercf = configparser.ConfigParser()cf.read('case.config', encoding='utf-8')# 读取配置文件res1 = cf.get('MODE', 'mode')print(res1)# 读取配置文件res 阅读全文
posted @ 2022-03-30 12:54 狒狒桑 阅读(27) 评论(0) 推荐(0) 编辑
摘要:代码: import unittestfrom ddt import ddt,data,unpacktest_data = [[1,3],[4,5]]test_data1 = [[1,3], [6,7]]test_data2 = [{"name":"haha", "pwd":"123"}, {"na 阅读全文
posted @ 2022-03-30 01:00 狒狒桑 阅读(127) 评论(0) 推荐(0) 编辑
摘要:from openpyxl import load_workbookclass ReadExcel: def __init__(self, wb_name, sheet_name): self.wb = load_workbook(wb_name) self.sheet = self.wb[shee 阅读全文
posted @ 2022-03-30 00:43 狒狒桑 阅读(44) 评论(0) 推荐(0) 编辑
摘要:from openpyxl import load_workbook#1 打开Excel,返回工作簿wb = load_workbook("test_excel01.xlsx")#2 定位表单, 返回表单对象sheet = wb['test']#3 定位单元格res = sheet.cell(1, 阅读全文
posted @ 2022-03-29 18:32 狒狒桑 阅读(23) 评论(0) 推荐(0) 编辑
摘要:class GetData: Cookie = "xiao"print(GetData.Cookie)setattr(GetData, 'Cookie', "da")print(getattr(GetData, 'Cookie'))print(hasattr(GetData, 'Cookie'))d 阅读全文
posted @ 2022-03-29 17:19 狒狒桑 阅读(14) 评论(0) 推荐(0) 编辑
摘要:1. 基础类 class MathMethod: def __init__(self,a,b): self.a = a self.b = b def add(self): return self.a + self.b def sub(self): return self.a - self.b def 阅读全文
posted @ 2022-03-29 13:43 狒狒桑 阅读(50) 评论(0) 推荐(0) 编辑
摘要:class MathMethod: def __init__(self,a,b): self.a = a self.b = b def add(self): print("我是父类的", self.a + self.b) def sub(self): print( self.a - self.b)c 阅读全文
posted @ 2022-03-28 23:39 狒狒桑 阅读(38) 评论(0) 推荐(0) 编辑
摘要:class BoyFriend: # 类属性 height = 175 weight = 120 money = "500万" def __init__(self, name, age): self.name = name self.age = age # 类函数 def cooking(self, 阅读全文
posted @ 2022-03-28 19:09 狒狒桑 阅读(22) 评论(0) 推荐(0) 编辑
摘要:import ostry: os.rmdir('aaa')except Exception as e: print(e)try: os.rmdir('aaa')except Exception as e: print(e) raisefinally: print('last')try: os.rmd 阅读全文
posted @ 2022-03-28 17:15 狒狒桑 阅读(8) 评论(0) 推荐(0) 编辑
摘要:import numpy as nparray1 = np.array([1,2,3,4])print(array1)array2 = np.array((1,2,3,4))print(array2)array3 = np.array([[1,2,3,4], [5,6,7,8]])print(arr 阅读全文
posted @ 2022-03-28 16:50 狒狒桑 阅读(20) 评论(0) 推荐(0) 编辑
摘要:# 遍历当前目录下所有文件 def read_file(path): if os.path.isdir(path): file_dirs = os.listdir(path) for file_dir in file_dirs: if os.path.isdir(os.path.join(path, 阅读全文
posted @ 2022-03-28 16:47 狒狒桑 阅读(57) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示