前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Python读取结果写入Excel中

Python读取结果写入Excel中

作者头像
清菡
发布2020-12-02 15:46:54
2.3K0
发布2020-12-02 15:46:54
举报
文章被收录于专栏:清菡软件测试清菡软件测试

文章总览图

Python写结果到Excel中

列表嵌套字典。Excel中的url,test_method,data,title等都是一个键,url,test_method,data,title下面的数据就是要取的值,也就是Key和value的形式。

1.根据case_id获取行数

登录

先创建一个requests.py文件用request模块调用接口。

代码语言:javascript
复制
import requests

class HttpRequest:
    def http_request(self,url,data,http_method,cookie=None):
        try :
            if http_method.upper()=='POST':
                    res=requests.post(url,data,cookies=cookie)
            elif http_method.upper()=='POST':
                    res=requests.post(url,data,cookies=cookie)
            else:
                print("输入的请求方法不对")
        except Exception as e:
            print("请求报错了:{0}".format(e))
            raise e
        return res#返回结果

if __name__ =='__main__':
        #注册
        register_url= 'http://api.nnzhp.cn/api/user/add_stu'
        register_data= { "name":"niuhanyang","grade":"天蝎座","phone":'18614711314'}

        #登录
        login_url= 'http://api.nnzhp.cn/api/user/login'
        login_data={"username": "niuhanyang", "passwd": 'aA123456'}


        # 充值
        recharge_url= 'http://api.nnzhp.cn/api/user/gold_add'
        recharge_data={"stu_id": "2170", "gold": '1'}

        login_res=HttpRequest().http_request(login_url,login_data,'post')
        recharge_res=HttpRequest().http_request(recharge_url,recharge_data,'post',login_res.cookies)
        print("充值结果:{}".format(recharge_res.json()))

文件test_data_xiejinjieguo_jiacaseid.xlsx

文件do_excel_xiejinjieguo_jiacaseid.py

代码语言:javascript
复制
from openpyxl import load_workbook


class DoExcel:
    def get_data(self,file_name,sheet_name):
        wb=load_workbook(file_name)
        sheet=wb[sheet_name]

        test_data=[]
        for i in range(2,sheet.max_row+1):#
            print('sheet.max_row是:',sheet.max_row)
            row_data={}
            row_data['case_id'] = sheet.cell(i, 1).value  #第1列第2行
            row_data['url']=sheet.cell(i,2).value
            row_data['data'] = sheet.cell(i, 3).value
            row_data['title'] = sheet.cell(i, 4).value
            row_data['http_method'] = sheet.cell(i,5).value

            test_data.append(row_data)
        return test_data

#把结果写进Excel
    def write_back(self,file_name,sheet_name,i,value):#专门写回数据
        wb=load_workbook(file_name)
        sheet=wb[sheet_name]
        sheet.cell(i,6).value=value
        wb.save(file_name)#保存结果

if __name__ =='__main__':

    test_data=DoExcel().get_data("../test_data/test_data_xiejinjieguo_jiacaseid.xlsx", 'login')
    print(test_data)
    
#错误提示:No such file or directory: 'test_data_xiejinjieguo_jiacaseid.xlsx'  相对路径和绝对路径

#涉及Excel写操作,一定要关掉Excel

文件run_xiejinjieguo_jiacaseid.py

代码语言:javascript
复制
#执行代码的入口

from tools.http_request import HttpRequest
from tools.do_excel_xiejinjieguo_jiacaseid import DoExcel
def run(test_data):#列表嵌套字典的数据格式进来
    for item in test_data:
        print("正在测试的用例是{0}".format(item['title']))
        res = HttpRequest().http_request(item['url'], eval(item['data']),item['http_method'])#遍历,取值
        print("请求的结果是:{0}".format(res.text))
        DoExcel().write_back("test_data/test_data_xiejinjieguo_jiacaseid.xlsx", 'login', item['case_id']+1 , str(res.text))#item['case_id']表示行数
        # item['case_id']+1表示在第二行

test_data=DoExcel().get_data("test_data/test_data_xiejinjieguo_jiacaseid.xlsx", 'login')
print('读出来是:',test_data)
run(test_data)

'''
报错:
raise ValueError("Cannot convert {0!r} to Excel".format(value))
ValueError: Cannot convert {'error_code': 0, 'login_info': {'login_time':
'20200211084505', 'sign': '748fc064f1e33a00fad24b2600381c72', 'userId': 2170}} to Excel
提示不能写进Excel里面去,只能写数字和字符串,那么就强制转换一下,加上str
'''
# i是行,j是列

已创建requests.py,文件test_data_xiejinjieguo_jiacaseid.xlsx,文件do_excel_xiejinjieguo_jiacaseid.py,文件run_xiejinjieguo_jiacaseid.py,运行文件run_xiejinjieguo_jiacaseid.py

输出结果如下:

不加case_id,使用range

登录

文件

test_data_xiejinjieguo_bujiacaseid.xlsx

文件

do_excel_xiejinjieguo_bujiacaseid.py

代码语言:javascript
复制
from openpyxl import load_workbook


class DoExcel:
    def get_data(self,file_name,sheet_name):
        wb=load_workbook(file_name)
        sheet=wb[sheet_name]

        test_data=[]
        for i in range(2,sheet.max_row+1):#max_row+1表示2 3 4 5执行四条用例,如果不加1,就少执行1条用例
            row_data={}
            row_data['url']=sheet.cell(i,1).value#第一列,第2行
            row_data['data'] = sheet.cell(i, 2).value
            row_data['title'] = sheet.cell(i, 3).value
            row_data['http_method'] = sheet.cell(i, 4).value
            test_data.append(row_data)
        return test_data

#把结果写进Excel
    def write_back(self,file_name,sheet_name,i,value):#专门写回数据
        wb=load_workbook(file_name)
        sheet=wb[sheet_name]
        sheet.cell(i,5).value=value
        wb.save(file_name)#保存结果

if __name__ =='__main__':

    test_data=DoExcel().get_data("../test_data/test_data_xiejinjieguo_bujiacaseid.xlsx", 'login')
    print(test_data)
# No such file or directory: 'test_data_xiejinjieguo_jiacaseid.xlsx'  相对路径和绝对路径

#涉及Excel写操作,一定要关掉Excel

文件run_xiejinjieguo_bujiacaseid.py

代码语言:javascript
复制
#执行代码的入口

from tools.http_request import HttpRequest
from tools.do_excel_xiejinjieguo_bujiacaseid import DoExcel
def run(test_data):#列表嵌套字典的数据格式进来
    for e in range(len(test_data)):#range是取头不取尾,假如有4个数,就是0,1,2,3。e代表列表有几个元素就是几。4个元素,长度就是4,
        # 那就是0,1,2,3  三个元素
        # 从0开始,根据索引取值。
        print("正在测试的用例是:{0}".format(test_data[e]['title']))
        res = HttpRequest().http_request(test_data[e]['url'],eval(test_data[e]['data']),test_data[e]['http_method'])#
        print("请求的结果是:{0}".format(res.json()))
        DoExcel().write_back("test_data/test_data_xiejinjieguo_bujiacaseid.xlsx", 'login', e+2, str(res.json()))#e+2表示第二行
test_data=DoExcel().get_data("test_data/test_data_xiejinjieguo_bujiacaseid.xlsx", 'login')
run(test_data)

已创建文件requests.py,文件test_data_xiejinjieguo_bujiacaseid.xlsx,

文件do_excel_xiejinjieguo_bujiacaseid.py,文件run_xiejinjieguo_bujiacaseid.py,运行文件run_xiejinjieguo_bujiacaseid.py

输出结果如下:

注册

文件test_data_xiejinjieguo_zhuce.xlsx

文件http_request_xiejinjieguo_zhuce.py

代码语言:javascript
复制
import requests

class HttpRequest:
    def http_request(self,url,data,http_method,cookie=None):
        try :
            if http_method.upper()=='POST':
                    res=requests.post(url,json=data,cookies=cookie)#不指定就默认fromdata,json只能传json格式的,
                    # 接口是json格式的,用data需要指定,所以写成json=data
            elif http_method.upper()=='POST':
                    res=requests.post(url,json=data,cookies=cookie)
            else:
                print("输入的请求方法不对")
        except Exception as e:
            print("请求报错了:{0}".format(e))
            raise e
        return res#返回结果


if __name__ =='__main__':
        #注册
        register_url= 'http://api.nnzhp.cn/api/user/add_stu'
        register_data= { "name":"niuhanyang","grade":"天蝎座","phone":'18614711314'}

        #登录
        login_url= 'http://api.nnzhp.cn/api/user/login'
        login_data={"username": "niuhanyang", "passwd": 'aA123456'}


        # 充值
        recharge_url= 'http://api.nnzhp.cn/api/user/gold_add'
        recharge_data={"stu_id": "2170", "gold": '1'}

        login_res=HttpRequest().http_request(login_url,login_data,'post')
        recharge_res=HttpRequest().http_request(recharge_url,recharge_data,'post',login_res.cookies)
        print("充值结果:{}".format(recharge_res.json()))

文件do_excel_xiejinjieguo_zhuce.py

代码语言:javascript
复制
from openpyxl import load_workbook
class DoExcel:
    def get_data(self,file_name,sheet_name):
        wb=load_workbook(file_name)
        sheet=wb[sheet_name]

        test_data=[]
        for i in range(2,sheet.max_row+1):#
            row_data={}
            row_data['case_id']= sheet.cell(i, 1).value  #第1列第2行
            row_data['url']=sheet.cell(i,2).value
            row_data['data'] = sheet.cell(i, 3).value
            row_data['title'] = sheet.cell(i, 4).value
            row_data['http_method'] = sheet.cell(i,5).value

            test_data.append(row_data)
        return test_data

#把结果写进Excel
    def write_back(self,file_name,sheet_name,i,value):#专门写回数据
        wb=load_workbook(file_name)
        sheet=wb[sheet_name]
        sheet.cell(i,6).value=value
        wb.save(file_name)#保存结果

if __name__ =='__main__':

    test_data=DoExcel().get_data("../test_data/test_data_xiejinjieguo_zhuce.xlsx", 'login')
    print(test_data)

文件run_xiejinjieguo_zhuce.py

代码语言:javascript
复制
#执行代码的入口

from tools.http_request_xiejinjieguo_zhuce import HttpRequest
from tools.do_excel_xiejinjieguo_zhuce import DoExcel
def run(test_data):#列表嵌套字典的数据格式进来
    for item in test_data:
        print("正在测试的用例是:{0}".format(item['title']))
        res = HttpRequest().http_request(item['url'],eval(item['data']),item['http_method'])#遍历,取值
        print("请求的结果是:{0}".format(res.json()))
        DoExcel().write_back("test_data/test_data_xiejinjieguo_zhuce.xlsx", 'register', item['case_id'] + 1, str(res.json()))#item['case_id']表示的行数
        # item['case_id']+1表示在第二行

test_data=DoExcel().get_data("test_data/test_data_xiejinjieguo_zhuce.xlsx", 'register')
run(test_data)

已创建文件test_data_xiejinjieguo_zhuce.xlsx,文件http_request_xiejinjieguo_zhuce.py,文件do_excel_xiejinjieguo_zhuce.py,文件run_xiejinjieguo_zhuce.py,执行文件run_xiejinjieguo_zhuce.py

输出结果如下:

充值-使用全局变量

文件

test_data_xiejinjieguo_chongzhi.xlsx

文件http_request_xiejinjieguo_chongzhi.py

代码语言:javascript
复制
import requests


class HttpRequest:
    def http_request(self,url,data,http_method,cookie=None):
        try :
            if http_method.upper()=='POST':
                    res=requests.post(url,data,cookies=cookie)#不指定就默认fromdata,json只能传json格式的,
                    # 接口是json格式的,用data需要指定,所以写成json=data
            elif http_method.upper()=='POST':
                    res=requests.post(url,data,cookies=cookie)
            else:
                print("输入的请求方法不对")
        except Exception as e:
            print("请求报错了:{0}".format(e))
            raise e
        return res#返回结果


if __name__ =='__main__':
        #注册
        # register_url= 'http://api.nnzhp.cn/api/user/add_stu'
        # register_data= { "name":"niuhanyang","grade":"天蝎座","phone":'18614711314'}

        #登录
        login_url= 'http://api.nnzhp.cn/api/user/login'
        login_data={"username": "niuhanyang", "passwd": 'aA123456'}


        # 充值
        recharge_url= 'http://api.nnzhp.cn/api/user/gold_add'
        recharge_data={"stu_id": "2170", "gold": '1'}

        login_res=HttpRequest().http_request(login_url,login_data,'post')
        recharge_res=HttpRequest().http_request(recharge_url,recharge_data,'post',login_res.cookies)
        print("充值结果:{}".format(recharge_res.text))

文件do_excel_xiejinjieguo_chongzhi.py

代码语言:javascript
复制
from openpyxl import load_workbook
class DoExcel:
    def get_data(self,file_name,sheet_name):
        wb=load_workbook(file_name)
        sheet=wb[sheet_name]

        test_data=[]
        for i in range(2,sheet.max_row+1):#
            row_data={}
            row_data['case_id']= sheet.cell(i, 1).value  #第1列第2行
            row_data['url']=sheet.cell(i,2).value
            row_data['data'] = sheet.cell(i, 3).value
            row_data['title'] = sheet.cell(i, 4).value
            row_data['http_method'] = sheet.cell(i,5).value

            test_data.append(row_data)
        return test_data

#把结果写进Excel
    def write_back(self,file_name,sheet_name,i,value):#专门写回数据
        wb=load_workbook(file_name)
        sheet=wb[sheet_name]
        sheet.cell(i,6).value=value
        wb.save(file_name)#保存结果

if __name__ =='__main__':

    test_data=DoExcel().get_data("../test_data/test_data_xiejinjieguo_chongzhi.xlsx", 'login')
    print(test_data)

文件run_xiejinjieguo_chongzhi.py 此处使用了全局变量

代码语言:javascript
复制
#执行代码的入口
from tools.http_request_xiejinjieguo_chongzhi import HttpRequest
from tools.do_excel_xiejinjieguo_chongzhi import DoExcel

COOKIE=None
def run(test_data,sheet_name):#列表嵌套字典的数据格式进来
    global COOKIE
    for item in test_data:
        print("正在测试的用例是:{0}".format(item['title']))
        res = HttpRequest().http_request(item['url'],eval(item['data']),item['http_method'],COOKIE)#遍历,取值
        print(item['data'])
        if res.cookies:
            COOKIE=res.cookies
        print("请求的结果是:{0}".format(res.text))
        DoExcel().write_back("test_data/test_data_xiejinjieguo_chongzhi.xlsx", sheet_name, item['case_id'] + 1, str(res.text))#item['case_id']表示的行数
        # item['case_id']+1表示在第二行

test_data=DoExcel().get_data("test_data/test_data_xiejinjieguo_chongzhi.xlsx", 'recharge')
run(test_data,'recharge')
'''
报错:
raise ValueError("Cannot convert {0!r} to Excel".format(value))
ValueError: Cannot convert {'error_code': 0, 'login_info': {'login_time':
'20200211084505', 'sign': '748fc064f1e33a00fad24b2600381c72', 'userId': 2170}} to Excel
提示不能写进Excel里面去,只能写数字和字符串,那么就强制转换一下,加上str
'''
# i是行,j是列

已创建文件test_data_xiejinjieguo_chongzhi.xlsx,

文件http_request_xiejinjieguo_chongzhi.py,

文件do_excel_xiejinjieguo_chongzhi.py,

文件run_xiejinjieguo_chongzhi.py,执行文件文件run_xiejinjieguo_chongzhi.py

输出结果如下:

充值-反射

文件http_request_xiejinjieguo_fanshe.py

代码语言:javascript
复制
import requests
class HttpRequest:
    def http_request(self,url,data,http_method,cookie=None):
        try :
            if http_method.upper()=='POST':
                    res=requests.post(url,data,cookies=cookie)#不指定就默认fromdata,json只能传json格式的,
                    # 接口是json格式的,用data需要指定,所以写成json=data
            elif http_method.upper()=='POST':
                    res=requests.post(url,data,cookies=cookie)
            else:
                print("输入的请求方法不对")
        except Exception as e:
            print("请求报错了:{0}".format(e))
            raise e
        return res#返回结果


if __name__ =='__main__':
        #注册
        # register_url= 'http://api.nnzhp.cn/api/user/add_stu'
        # register_data= { "name":"niuhanyang","grade":"天蝎座","phone":'18614711314'}

        #登录
        login_url= 'http://api.nnzhp.cn/api/user/login'
        login_data={"username": "niuhanyang", "passwd": 'aA123456'}


        # 充值
        recharge_url= 'http://api.nnzhp.cn/api/user/gold_add'
        recharge_data={"stu_id": "2170", "gold": '1'}

        login_res=HttpRequest().http_request(login_url,login_data,'post')
        recharge_res=HttpRequest().http_request(recharge_url,recharge_data,'post',login_res.cookies)
        print("充值结果:{}".format(recharge_res.text))

文件do_excel_xiejinjieguo_fanshe.py

代码语言:javascript
复制
from openpyxl import load_workbook

class DoExcel:
    def get_data(self,file_name,sheet_name):
        wb=load_workbook(file_name)
        sheet=wb[sheet_name]

        test_data=[]
        for i in range(2,sheet.max_row+1):#
            row_data={}
            row_data['case_id']= sheet.cell(i, 1).value  #第1列第2行
            row_data['url']=sheet.cell(i,2).value
            row_data['data'] = sheet.cell(i, 3).value
            row_data['title'] = sheet.cell(i, 4).value
            row_data['http_method'] = sheet.cell(i,5).value

            test_data.append(row_data)
        return test_data

#把结果写进Excel
    def write_back(self,file_name,sheet_name,i,value):#专门写回数据
        wb=load_workbook(file_name)
        sheet=wb[sheet_name]
        sheet.cell(i,6).value=value
        wb.save(file_name)#保存结果

if __name__ =='__main__':

    test_data=DoExcel().get_data("../test_data/test_data_xiejinjieguo_chongzhi.xlsx", 'login')
    print(test_data)

文件get_cookie.py

代码语言:javascript
复制
#反射:不管何时何地,只要传入一个类名,它就可以帮你操作。
class GetCookie:
    Cookie=None

# setattr(GetCookie,'Cookie','123456')#set attribute 设置属性值
# print(hasattr(GetCookie,'Cookie'))#has attribute 判断是否有这个属性
# delattr(GetCookie,'Cookie')#delete attribute 删除这个属性
# print(getattr(GetCookie,'Cookie'))#get attribute 获取属性值

文件run_xiejinjieguo_fanshe.py

代码语言:javascript
复制
#执行代码的入口
from tools.http_request_xiejinjieguo_fanshe import HttpRequest
from tools.do_excel_xiejinjieguo_fanshe import DoExcel
from tools.get_cookie import GetCookie


def run(test_data,sheet_name):#列表嵌套字典的数据格式进来

    for item in test_data:
        print("正在测试的用例是:{0}".format(item['title']))
        res = HttpRequest().http_request(item['url'],eval(item['data']),item['http_method'],getattr(GetCookie,'Cookie'))#遍历,取值
        print(item['data'])
        if res.cookies:
            setattr(GetCookie,'Cookie',res.cookies)#反射
            # 反射是在当前文件运行的时候都会生效,下一次运行的时候会重新生成这样的属性值。
        print("请求的结果是:{0}".format(res.text))
        DoExcel().write_back("test_data/test_data_xiejinjieguo_chongzhi.xlsx", sheet_name, item['case_id'] + 1, str(res.text))#item['case_id']表示的行数
        # item['case_id']+1表示在第二行

test_data=DoExcel().get_data("test_data/test_data_xiejinjieguo_chongzhi.xlsx", 'recharge')
run(test_data,'recharge')

已创建test_data_xiejinjieguo_chongzhi.xlsx,文件http_request_xiejinjieguo_fanshe.py,

文件do_excel_xiejinjieguo_fanshe.py,文件get_cookie.py,

文件run_xiejinjieguo_fanshe.py,执行文件文件run_xiejinjieguo_fanshe.py

输出结果如下:

注册接口是字典类型提交的

因为注册接口是字典类型提交的,默认是表单提交,用json.dumps()

代码语言:javascript
复制
import requests
import json

register_url= 'http://api.nnzhp.cn/api/user/add_stu'
register_data= { "name":"niuhanyang","grade":"天蝎座","phone":'18614711314'}
res=requests.post(register_url,data=json.dumps(register_data))
print("json解析的结果",res.json())
'''
post请求方法:post(url,data=None,json=None,**kwargs)
data是post方法的形式参
register_data是你的实参,data是形参
理解成把你的字典数据赋值给这个post的参数
这是字典类型提交 默认是表单提交  ,用json.dumps()
json.dumps()并不是转表单,用json.dumps()只适用此处。
'''
login_url= 'http://api.nnzhp.cn/api/user/login'
login_data={"username": "niuhanyang", "passwd": 'aA123456'}
login_res=requests.post(login_url,login_data)
print("json解析的结果",login_res.json())
#什么时候用json()进行解析?只有当你返回的数据是这种类型的时候。

recharge_url= 'http://api.nnzhp.cn/api/user/gold_add'
recharge_data={"stu_id": "2170", "gold": '1'}
# header={"User-Agent":"Mozilla/5.0"}
# recharge_res=requests.post(recharge_url,recharge_data,cookies=login_res.cookies,headers=header)
# print("json解析的结果",recharge_res.json())
# print("请求头:",recharge_res.request.headers)

'''
常见问题:
1.地址写错了,或者地址夹了空格。
2.结果不能被json()方式解析,就找不到问题,就用text方式去解析。

3.错误提示:ValueError:Expecting value:line 1 colunm 1 (char 0)
出现这种提示,绝对是地址错误了。
'''
# 拓展点:
#让所有的请求都在会话下
# s=requests.session()#创建了一个会话
# login_res=s.post(login_url,login_data)#如果是get请求就要加params=,详情看get源码,只有一个位置参数,所以要自己添加一个位置参数
# recharge_res=s.post(recharge_url,recharge_data)
# print("充值的结果是:",recharge_res.json())

拓展点

session:保证会话的有效性。

cookie:向服务器证明是同一个用户发起的请求,那么所有的请求里面都要加上cookie。

token:鉴权。防止非法访问。

Key:授权,只有拿到密钥才能访问。

Json和Python Dict的区别

json是字符串,dict是数据结构。

实际作用:

json.loads()把 JSON 字符串转换为 Python 字典格式。

json.dumps()把 python 字典转换为 JSON 字符串。

Post请求

Post请求一般有4种请求,分别是:

1、application/x-www-form-urlencoded浏览器原生表单

2、multipart/form-data

3、application/json

4、text/xml文本格式

所以需要加上请求内容类型Content-Type: XXXXX

Python处理Excel数据通常写法

代码语言:javascript
复制
def excel_to_list(data_file, sheet):
    data_list = []  # 新建个空列表,来乘装所有的数据
    wb = xlrd.open_workbook(data_file)  # 打开excel
    sh = wb.sheet_by_name(sheet)  # 获取工作簿
    header = sh.row_values(0)  # 获取标题行数据
    for i in range(1, sh.nrows):  # 跳过标题行,从第二行开始取数据
        d = dict(zip(header, sh.row_values(i)))  # 将标题和每行数据组装成字典
        data_list.append(d)
    return data_list  # 列表嵌套字典格式,每个元素是一个字典

总结

今天遇到的坑:

1.只要代码错误了,就会报错,excel里面就有空行,然后改回代码时还要记得删除空行。

2.网上的接口可能有bug,也有可能接口文档写的是json格式,实际上又有json格式又有html格式。

只有json类型的返回值才支持json,html和json在这里是不支持返回的。html,json()格式的,可以用text格式去获取。

本网站(http://doc.nnzhp.cn/index.php?s=/6&page_id=11)的充值接口不是json格式的,是json和html的格式的,接口文档错误!只能用text格式获取!

3.不能粗心,pycharm中右键拷贝复制文件,代码有可能会变!

4.excel中url,http_method,title,case_id下面的值,没有双引号,除data复制进来的值有自带的双引号,都没有双引号,无需额外加引号

5.目前发现,Excel中的值必须严格按照Excel格式排序,数字靠右,其它格式的值靠左,不能有多余空格。

注意:涉及Excel写操作,一定要关掉Excel。


本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2020-02-13,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 清菡软件测试 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 文章总览图
    • Python写结果到Excel中
      • 1.根据case_id获取行数
        • 不加case_id,使用range
          • 注册
            • 充值-使用全局变量
              • 充值-反射
                • 注册接口是字典类型提交的
                  • 拓展点
                    • Json和Python Dict的区别
                      • Post请求
                        • Python处理Excel数据通常写法
                          • 总结
                          领券
                          问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档