python读写excel文件

来源:互联网 发布:李兆会转移资产知乎 编辑:程序博客网 时间:2024/05/19 14:18

#rw Excel file in python

import xlrd

path=input("Please input the path of the file:")
workbook=xlrd.open_workbook(path)
sheet=workbook.sheet_by_index(0)
for row in range(sheet.nrows):
    print()
    for col in range(sheet.ncols):

        print("%7s"%sheet.row(row)[col].value,'\t',end='')


#转载自http://www.icourse163.org/learn/BIT-268001#/learn/content?type=detail&id=1002613059&cid=1002856176

原创粉丝点击