當前位置:生活全書館 >

IT科技

> pythonexcel資料處理教程

pythonexcel資料處理教程

產品型號:ASUS S340MC

系統版本:Windows 10

軟體版本:python2020

python excel資料處理下總共需要5步操作,具體的操作步驟如下:

1、在python專案中,新建python檔案,並依次匯入xlrd和xlwt。

pythonexcel資料處理教程

2、接著呼叫open_workbook方法,開啟一個excel檔案。

pythonexcel資料處理教程 第2張

3、呼叫sheet_by_name方法,讀取檔案的sheet頁。

pythonexcel資料處理教程 第3張

4、利用sheets方法加序號,可以獲取某個sheet頁物件。

pythonexcel資料處理教程 第4張

5、在cell中傳入兩個值,一個行一個列,然後value即可獲取對應單元格的值。

pythonexcel資料處理教程 第5張

總結

1、在python專案中,新建python檔案,並依次匯入xlrd和xlwt。

2、接著呼叫open_workbook方法,開啟一個excel檔案。

3、呼叫sheet_by_name方法,讀取檔案的sheet頁。

4、利用sheets方法加序號,可以獲取某個sheet頁物件。

5、在cell中傳入兩個值,一個行一個列,然後value即可獲取對應單元格的值。

  • 文章版權屬於文章作者所有,轉載請註明 https://shqsg.com/dianzi/94g8ek.html