python对excel文件的读写操作

import xlrd,xlwt

data = xlrd.open_workbook('a.xlsx')   #
table = data.sheets()[0]
data_list = []
data_list.extend(table.row_values(0))
for item in data_list:
    print item
#################
#
data = xlwt.Workbook()
table = data.add_sheet('b')
table.write(0, 1, '01')
table.write(0, 2, 'www')
data.save('b.xls')

http://wenqiang-china.github.io/2016/05/13/python-opetating-excel/

posted @ 2017-03-23 18:32  webbky  阅读(316)  评论(0编辑  收藏  举报