這篇文章主要介紹怎樣基于python操作excel并獲取內(nèi)容,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!
背景:從excel表中獲取請(qǐng)求url、請(qǐng)求數(shù)據(jù)、請(qǐng)求類型、預(yù)期結(jié)果
因此,需要學(xué)會(huì)如何使用python從excel獲取這些信息
#coding=utf-8 import xlrd #創(chuàng)建對(duì)象時(shí),獲取對(duì)應(yīng)excel 表格 #讀取Excel行數(shù) #獲取單元格內(nèi)容 class OperationExcel: def __init__(self,file_name = None,sheet_id = 0): if file_name: self.file_name = file_name self.sheet_id = sheet_id else: self.file_name = '../data.xlsx' self.sheet_id = 0 self.data =self.get_data() def get_line(self): return self.data.nrows def get_cell_value(self,row,col): return self.data.cell_value(row,col) def get_data(self): data = xlrd.open_workbook(self.file_name) tables = data.sheets()[self.sheet_id] return tables if __name__ == '__main__': opers = OperationExcel() print opers.get_line() print opers.get_cell_value(1,0)
以上是“怎樣基于python操作excel并獲取內(nèi)容”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
本文標(biāo)題:怎樣基于python操作excel并獲取內(nèi)容-創(chuàng)新互聯(lián)
文章轉(zhuǎn)載:http://www.chinadenli.net/article20/dhsico.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供做網(wǎng)站、網(wǎng)站建設(shè)、面包屑導(dǎo)航、App設(shè)計(jì)、軟件開(kāi)發(fā)、網(wǎng)站策劃
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容