文章分类 -  数据驱动的几种方法

ORM框架
摘要:1 ..\orm\mysql_config.py 2 3 def set_mysql_config(env): 4 if env=='pro': 5 db_config={ 6 'user':'root', 7 'password':'*', 8 'host':'127.0.0.1'... 阅读全文

posted @ 2019-07-13 12:02 cherry_ning 阅读(204) 评论(0) 推荐(0)

ddt数据驱动
摘要:1 from ddt import ddt,data,unpack 2 3 @ddt 4 class Login_test(StartEnd): 5 6 # @data(('13337001566','afsada0'),('','')) 7 @data(('13337001566','afsada0'),) 8 @unpack 9 def ... 阅读全文

posted @ 2019-07-13 11:33 cherry_ning 阅读(108) 评论(0) 推荐(0)

csv数据读取方法
摘要:1 import csv 2 3 def get_csv_data(csv_file, line): 4 with open(csv_file, 'r') as file: 5 reader = csv.reader(file) 6 for index, row in enumerate(reade 阅读全文

posted @ 2019-07-13 11:25 cherry_ning 阅读(200) 评论(0) 推荐(0)

数据库-将列名对应的值一起打印出来
摘要:1 import pymysql 2 3 class Get_sql(): 4 def __init__(self): 5 self.db = pymysql.connect(host='127.0.0.1', port=3306, user='root', password='**', db='book') 6 7 def get_sql(s... 阅读全文

posted @ 2019-07-13 11:14 cherry_ning 阅读(364) 评论(0) 推荐(0)

yaml数据的读取
摘要:yaml语法如下: familyInfo.yaml yaml去掉警告信息: data=yaml.load(file,Loader=yaml.FullLoader) 阅读全文

posted @ 2019-07-13 11:09 cherry_ning 阅读(236) 评论(0) 推荐(0)

数据库重置数据
摘要:1 import pymysql 2 import yaml 3 4 class Get_sql(): 5 def __init__(self): 6 #连接数据库 7 self.db = pymysql.connect(host='127.0.0.1', port=3306, user='root', password='**', db=... 阅读全文

posted @ 2019-07-13 11:01 cherry_ning 阅读(920) 评论(0) 推荐(0)

读取excel方法
摘要:1 import xlrd 2 from xlutils.copy import copy 3 4 # datas=xlrd.open_workbook('./case1.xls') 5 # table=datas.sheet_by_index(0) 6 # table=datas.sheets()[0] 7 # print(table.nrows) 8 # print(tab... 阅读全文

posted @ 2019-07-13 10:35 cherry_ning 阅读(191) 评论(0) 推荐(0)

导航