欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

python使用xlrd模塊讀取xlsx文件中的ip方法

 更新時間:2019年01月11日 14:29:37   作者:comprel  
今天小編就為大家分享一篇python使用xlrd模塊讀取xlsx文件中的ip方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧

程序中經(jīng)常需要使用excel文件,批量讀取文件中的數(shù)據(jù)

python讀取excel文件可以使用xlrd模塊

pip install xlrd安裝模塊

示例:

#coding=utf8

import xlrd
from os import path
import sys

filename='ip.xlsx'
if not path.isfile(filename):
 print "err: not exists or not file ip.xlsx "
 sys.exit()

getfile=xlrd.open_workbook(filename)
table=getfile.sheet_by_index(0)
rows=table.nrows
#cols=table.ncols 若有多列,再加一層for循環(huán)
for i in xrange(rows):
 cell_vlaues=table.cell_value(i,0)
 print cell_vlaues

以上這篇python使用xlrd模塊讀取xlsx文件中的ip方法就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論