08 2022 档案
摘要:import xlrdfrom xlutils.copy import copydef get_data(): wb = xlrd.open_workbook('data.xls') sh = wb.sheet_by_index(0) all_data = {} for r in range(sh.
阅读全文
摘要:import xlrdfrom xlutils.copy import copydef read_data(): wb = xlrd.open_workbook('data.xls') sh = wb.sheet_by_index(0) fen_type = {} count_price = []
阅读全文
摘要:import xlwtwb = xlwt.Workbook()sh = wb.add_sheet('数据')ft = xlwt.Font()# 设置字体ft.name = '微软雅黑'# 设置颜色ft.colour_index = 2# 设置字体大小ft.height = 11 * 20# 设置加粗
阅读全文
摘要:import xlrdfrom xlutils.copy import copy# 打开excelread_book = xlrd.open_workbook('01_电影数据.xls')# 复制数据wb = copy(read_book)# 选择工作簿sh1 = wb.get_sheet(0)sh
阅读全文
摘要:import xlrd# 打开excelwb = xlrd.open_workbook('01_电影数据.xls')# 选择工作簿print(f'excel中有{wb.nsheets}个工作簿')print(f'excel中sheets的名字:{wb.sheet_names()}')# 选择工作簿s
阅读全文
摘要:import xlwt# 创建一个excelwb = xlwt.Workbook()# 选择工作簿sh1 = wb.add_sheet('电影')# 写入数据到单元格sh1.write(0, 0, '影片')sh1.write(0, 1, '综合票房')sh1.write(0, 2, '票房占比')
阅读全文