excel、xls文件读写操作

python 常用的excel、xls文件读写操作,有两个模块

  xlrd:读

  xlwt:写

本次先写一个读的例子:

  

class CaseData(object):
	def __init__(self, fp):
		self.data = {}
                # 获取工作簿对象
		data = xlrd.open_workbook(fp)
    
		for i in range(0, 8):
                        # 读取index为0的sheet中index为1的行
			table = data.sheets()[0].row_values(1)
			self.data[table[0]] = table[1]

  

原文地址:https://www.cnblogs.com/chenadong/p/9924015.html