接口测试-将数据写入csv中

社会主义新天地 提交于 2020-01-19 18:57:22

将接口测试的返回值,写入到表格中

 

 

# 将testresult的数据写入csv中# w为覆盖写,a为追加写import csvtestresult = {"接口名称":"登录接口","测试结果":"测试通过"}file = open("test2.csv","w")for key,value,in testresult.items():    print(key,value)    file.write(str(key)+","+str(value)+"\n")file.close()

 

 

 

testresult = {"接口名称":"登录接口","测试结果":"测试通过"}file = open("test3.csv","w")for key,value,in testresult.items():    print(key,value)    file.write(str(key)+","+str(value)+",")file.write("\n")file.close()

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!