1、Pandas库的读取操作
from pandas import read_excel
dr=read_excel(filename,header)
dr#dataframe数据
dw=DataFrams(data=dict,columns=dict.keys())
dw.to_excel(filename)
2、xlrd/xlwt
2.1、xlrd——读取
work_book=xlrd.open_workbook(filename)
sheet1=work_book.sheet_by_name('Sheet1')
#shee1=work_book,sheet_by_index(0)
sheet1.cell_value(row,col)
sheet1.row(i) #返回列表,内容为数据类型:数据内容的字典;
sheet1.row_values(i)#返回i行数据内容
sheet1.col(i)
sheet1.col_values(i)
2.2、xlwt——写入
dw=xlwt.Workbook()
sheet_1=dw.add_sheet('sheet1',cell_overwrite_ok=True)
sheet_1.write(row,col,string)
dw.save(filename)