• python读取excel


     1 import xlrd
     2 book = xlrd.open_workbook('app_student.xls')
     3 sheet = book.sheet_by_index(0)
     4 # sheet2 = book.sheet_by_name('shee1')
     5 # print(sheet.cell(0,0).value) #指定sheet页里面行和lie获取数据
     6 # print(sheet.cell(1,0).value) #指定sheet页里面行和lie获取数据
     7 # print(sheet.row_values(0)) #这个获取到第几行的内容
     8 # print(sheet.row_values(1)) #这个获取到第几行的内容
     9 # print(sheet.nrows) #获取到excel里面总共有多少行
    10 for i in range(sheet.nrows):  #循环获取到每行数据
    11     print(sheet.row_values(i))
    12 #print(sheet.ncols)  #总共多少列
    13 #print(sheet.col_values(0)) #取第几列的数据
    人生的旅途,前途很远,也很暗。然而不要怕,不怕的人的面前才有路。
  • 相关阅读:
    面试
    vue axios 应用
    3D全景之ThreeJs
    css垂直居中
    事件处理过程中遇到的问题
    文字溢出
    jquery: 偏移量计算
    jquery: sand picture
    jquery: update carousel logic & animate
    jquery: carousel arrow click
  • 原文地址:https://www.cnblogs.com/ymany/p/9026659.html
Copyright © 2020-2023  润新知