import xlrd? ? ? #導入 xlrd的包
#1.打開excel文件
data=xlrd.open_workbook('xie.xlsx')
#2.讀取excel表格
table=data.sheets()[0]
#3.讀取表格中行數(shù)
rows=table.nrows
#4.讀取第一行的數(shù)據(jù)彪薛,table.row_values(x) ,x表示索引值
rowvalue=table.row_values(1)
print('---------------------')
#打印姓名和性別
print('姓名'+'\t'+'\t'+'性別')
#使用for循環(huán)打印姓名對應的性別信息
for i in range(1,rows):
print(table.row_values(i)[0]+' '+'\t'+table.row_values(i)[1])