1 #-*- coding: utf-8 -*-
2 """
3 Created on Thu May 24 13:53:10 20184
5 @author: Frank6 """
7
8 importxlrd #xlrd is a library for reading data and formatting information from Excel files, whether they are .xls or .xlsx files.9
10 data = xlrd.open_workbook(‘通讯录.xlsx‘)#打开 Excel文件11 print(type(data))12 table =data.sheets()[0]13 print(type(table))14 nrows = table.nrows #行数
15 print("行数:{}".format(nrows))16 ncols = table.ncols #列数
17 print("列数:{}".format(ncols))18 for i inrange(0,nrows):19 rowValues = table.row_values(i) #某一行数据
20 #print(type(rowValues))
21 #print(rowValues)
22 print("姓名:{}电话:{}".format(rowValues[0], rowValues[1]))
xlrd.open_workbook(filename=None, logfile=<_io.textiowrapper name="‘<stdout">‘ mode=‘w‘ encoding=‘UTF-8‘>, ve