import xlrd
xlsx=xlrd.open_workbook(r'D:\chengji.xls')
//定义xlsx
sheet=xlsx.sheet_names()
//定义sheet
print(sheet)
//输出sheet
data=xlsx.sheet_by_name('Sheet1')
//定义data
print(data)
//输出data
rows=data.nrows
//大家知道这里的nrows是什么意思么?
tmp=data
import xlrd
xlsx=xlrd.open_workbook(r'D:\chengji.xls')
sheet=xlsx.sheet_names()
print(sheet)
data=xlsx.sheet_by_name('Sheet1')
print(data)
rows=data.nrows
# tmp=data.row(rowx=2)
# tmp=data.row(rowx = 1, )
for i in range (0,rows):
print(data.row(rowx=i))
结果:
['Sheet1'] Sheet ?0:<Sheet1> [text:'姓名', text:'学号', text:'英语', text:'语文', text:'数学', text:'总分', text:'平均分', text:'排名', empty:'', empty:'', empty:'', text:'出生日期', empty:'', empty:''] [text:'张11', number:2021011.0, number:99.0, number:87.0, number:99.0, number:285.0, number:95.0, number:1.0, empty:'', text:'王1', text:'张三三', xldate:33219.0, number:2021011.0, text:'优秀'] [text:'张4', number:2021004.0, number:92.0, number:92.0, number:89.0, number:273.0, number:91.0, number:2.0, empty:'', text:'王', text:'张4', xldate:33219.0, number:2021025.0, text:'优秀'] [text:'张7', number:2021007.0, number:95.0, number:78.0, number:95.0, number:268.0, number:89.33333333333333, number:3.0, empty:'', text:'王', text:'张7', xldate:33219.0, number:2021025.0, text:'良好'] [text:'张20', number:2021020.0, number:99.0, number:99.0, number:70.0, number:268.0, number:89.33333333333333, number:3.0, empty:'', text:'王0', text:'张20', xldate:33219.0, number:2021020.0, text:'合格'] [text:'张12', number:2021012.0, number:100.0, number:66.0, number:100.0, number:266.0, number:88.66666666666667, number:5.0, empty:'', text:'王2', text:'张三2', xldate:33219.0, number:2021012.0, text:'合格'] [text:'张3', number:2021003.0, number:91.0, number:78.0, number:91.0, number:260.0, number:86.66666666666667, number:6.0, empty:'', text:'王', text:'张3', xldate:33219.0, number:2021025.0, text:'良好'] [text:'张8', number:2021008.0, number:96.0, number:67.0, number:96.0, number:259.0, number:86.33333333333333, number:7.0, empty:'', text:'王', text:'张8', xldate:33219.0, number:2021025.0, text:'合格'] [text:'张17', number:2021017.0, number:78.0, number:90.0, number:90.0, number:258.0, number:86.0, number:8.0, empty:'', text:'王7', text:'张三7', xldate:33219.0, number:2021017.0, text:'良好'] [text:'张6', number:2021006.0, number:94.0, number:94.0, number:67.0, number:255.0, number:85.0, number:9.0, empty:'', text:'王', text:'张6', xldate:35411.0, number:2021025.0, text:'合格'] [text:'张9', number:2021009.0, number:56.0, number:97.0, number:97.0, number:250.0, number:83.33333333333333, number:10.0, empty:'', text:'王', text:'张9', xldate:33219.0, number:2021025.0, text:'不合格'] [text:'张19', number:2021019.0, number:76.0, number:86.0, number:86.0, number:248.0, number:82.66666666666667, number:11.0, empty:'', text:'王9', text:'张三9', xldate:33219.0, number:2021016.0, text:'良好'] [text:'张28', number:2021028.0, number:90.0, number:67.0, number:90.0, number:247.0, number:82.33333333333333, number:12.0, empty:'', text:'王8', text:'张28', xldate:33219.0, number:2021025.0, text:'合格'] [text:'张2', number:2021002.0, number:90.0, number:90.0, number:65.0, number:245.0, number:81.66666666666667, number:13.0, empty:'', text:'王', text:'张2', xldate:33219.0, number:2021015.0, text:'合格'] [text:'张18', number:2021018.0, number:87.0, number:67.0, number:87.0, number:241.0, number:80.33333333333333, number:14.0, empty:'', text:'王8', text:'张三8', xldate:33219.0, number:2021015.0, text:'合格'] [text:'张10', number:2021010.0, number:98.0, number:98.0, number:45.0, number:241.0, number:80.33333333333333, number:14.0, empty:'', text:'王0', text:'张三0', xldate:33219.0, number:2021010.0, text:'不合格'] [text:'张1', number:2021001.0, number:89.0, number:89.0, number:56.0, number:234.0, number:78.0, number:16.0, empty:'', text:'王', text:'张三', xldate:33219.0, number:2021001.0, text:'不合格'] [text:'张23', number:2021023.0, number:98.0, number:33.0, number:98.0, number:229.0, number:76.33333333333333, number:17.0, empty:'', text:'王3', text:'张23', xldate:33219.0, number:2021022.0, text:'不合格'] [text:'张13', number:2021013.0, number:87.0, number:55.0, number:87.0, number:229.0, number:76.33333333333333, number:17.0, empty:'', text:'王3', text:'张三3', xldate:33219.0, number:2021013.0, text:'不合格'] [text:'张15', number:2021015.0, number:78.0, number:67.0, number:78.0, number:223.0, number:74.33333333333333, number:19.0, empty:'', text:'王5', text:'张三5', xldate:34680.0, number:2021015.0, text:'合格'] [text:'张5', number:2021005.0, number:93.0, number:34.0, number:93.0, number:220.0, number:73.33333333333333, number:20.0, empty:'', text:'王', text:'张5', xldate:33219.0, number:2021025.0, text:'不合格'] [text:'张21', number:2021021.0, number:78.0, number:64.0, number:78.0, number:220.0, number:73.33333333333333, number:20.0, empty:'', text:'王1', text:'张2三', xldate:33219.0, number:2021021.0, text:'合格'] [text:'张22', number:2021022.0, number:67.0, number:78.0, number:67.0, number:212.0, number:70.66666666666667, number:22.0, empty:'', text:'王2', text:'张22', xldate:33219.0, number:2021016.0, text:'合格'] [text:'张27', number:2021027.0, number:55.0, number:90.0, number:55.0, number:200.0, number:66.66666666666667, number:23.0, empty:'', text:'王7', text:'张27', xldate:33219.0, number:2021025.0, text:'不合格'] [text:'张14', number:2021014.0, number:54.0, number:90.0, number:54.0, number:198.0, number:66.0, number:24.0, empty:'', text:'王4', text:'张三4', xldate:36141.0, number:2021014.0, text:'不合格'] [text:'张16', number:2021016.0, number:56.0, number:70.0, number:56.0, number:182.0, number:60.666666666666664, number:25.0, empty:'', text:'王6', text:'张三6', xldate:33219.0, number:2021016.0, text:'不合格'] [text:'张24', number:2021024.0, number:43.0, number:43.0, number:88.0, number:174.0, number:58.0, number:26.0, empty:'', text:'王4', text:'张24', xldate:33219.0, number:2021024.0, text:'不合格'] [text:'张26', number:2021026.0, number:54.0, number:55.0, number:54.0, number:163.0, number:54.333333333333336, number:27.0, empty:'', text:'王6', text:'张26', xldate:33219.0, number:2021026.0, text:'不合格'] [text:'张25', number:2021025.0, number:46.0, number:46.0, number:66.0, number:158.0, number:52.666666666666664, number:28.0, empty:'', text:'王5', text:'张25', empty:'', empty:'', empty:'']
|