data=pd.read_excel(file)操作excel表格
获取到所有表头,输出为list:data.columns.values
获取到某几列数据:data=df.ix[:,['title','data']].values
转换成字典
df=pd.read_excel('lemon.xlsx') test_data=[] for i in df.index.values:#获取行号的索引,并对其进行遍历: #根据i来获取每一行指定的数据 并利用to_dict转成字典 row_data=df.ix[i,['case_id','module','title','http_method','url','data','expected']].to_dict() test_data.append(row_data) print("最终获取到的数据是:{0}".format(test_data))
引用:https://www.cnblogs.com/liulinghua90/p/9935642.html