#(1)导入模板xlrd import xlrd #如果没有此库需要提前安装:pip install xlrd #(2)打开工作簿book wb=xlrd.open_workbook("../Stu_Pack/school.xls") #创建文件对象 #(3)指定工作簿中的表单sheet sheet = wb.sheet_by_index(0) #创建工作表对象 schools = [] #创建二维列表存放表单内容 for row in range(sheet.nrows): school = [] for col in range(sheet.ncols): content = sheet.cell_value(row,col) school.append(content) #将变量内容追加到一堆列表school里面 for school in schools: print(school)
爬虫excel(python3.10,精简版)
最新推荐文章于 2024-11-22 14:29:45 发布
