""" author:少校 create Time:2025/2/26 10:25 越努力越幸运 """ from itertools import count # 练习1:获取前5个订单数据 import xlrd wb = xlrd.open_workbook("files/2020销售数据老.xls") sheet1 =wb["data"] for row in range(1,6): dingdan = sheet1.row_values(row) print(dingdan) # 练习2:获取第10到20个订单的销售渠道数据 xiaoshou = sheet1.col_values(4,10,20) print(xiaoshou) # 练习3:统计不同销售区域的订单数量 shuliang = {} quyu = sheet1.col_values(3,1) for x in quyu: if x not in shuliang: shuliang[x] = quyu.count(x) print(shuliang)
08.旧版xls文件读操作练习
本节519字2025-02-27 19:10:54