xlrd xlwt 开发模板
import xlrd
data = xlrd.open_workbook('lujing+wenjianming.xls')
all_sheet_list=data.sheet_names()
print(all_sheet_list)
table=data.sheet_by_name('工作表')
table=data.sheet_by_name(0)
name=table.name
nrows=table.nrows
ncols=table.ncols
row_txt_list=table.row_values(0)#行内容列表
col_txt_list=table.col_values(0)#列内容列表
data = xlrd.open_workbook('lujing+wenjianming.xls')
all_sheet_list=data.sheet_names()
print(all_sheet_list)
table=data.sheet_by_name('工作表')
table=data.sheet_by_name(0)
name=table.name
nrows=table.nrows
ncols=table.ncols
row_txt_list=table.row_values(0)#行内容列表
col_txt_list=table.col_values(0)#列内容列表
one_cell=table.cell(row,col).value#某一单元格
one_cell=table.cell_value(row,col)
one_cell=table.row(1)[0].value
one_cell=table.cell_value(row,col)
one_cell=table.row(1)[0].value
one_cell_type=type(cell(row,col).value)
import xlwt
workbook=xlwt.Workbook(encoding='utf-8')
sheet=workbook.add_sheet('工作表')
sheet.write(0,0,'word')#行,列,文字
workbook.save('lujing+wenjianming.xls')
workbook=xlwt.Workbook(encoding='utf-8')
sheet=workbook.add_sheet('工作表')
sheet.write(0,0,'word')#行,列,文字
workbook.save('lujing+wenjianming.xls')

浙公网安备 33010602011771号