python读取excel
生活随笔
收集整理的這篇文章主要介紹了
python读取excel
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
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獲取數(shù)據(jù)
6 # print(sheet.cell(1,0).value) #指定sheet頁里面行和lie獲取數(shù)據(jù)
7 # print(sheet.row_values(0)) #這個(gè)獲取到第幾行的內(nèi)容
8 # print(sheet.row_values(1)) #這個(gè)獲取到第幾行的內(nèi)容
9 # print(sheet.nrows) #獲取到excel里面總共有多少行
10 for i in range(sheet.nrows): #循環(huán)獲取到每行數(shù)據(jù)
11 print(sheet.row_values(i))
12 #print(sheet.ncols) #總共多少列
13 #print(sheet.col_values(0)) #取第幾列的數(shù)據(jù)
?
轉(zhuǎn)載于:https://www.cnblogs.com/ymany/p/9026659.html
總結(jié)
以上是生活随笔為你收集整理的python读取excel的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Feign api调用方式
- 下一篇: python自动测试n_接口自动化:Je