本人是python菜鸟,根本没学过,因为要用到所以搜索了段代码,链接如下:http://hi.baidu.com/%C0%E1%B9%FD%CE%DE%BA%DBno1/blog/item/b11e5b186e3143a94aedbc15.html代码如下:fromw...
本人是python菜鸟,根本没学过,因为要用到所以搜索了段代码,链接如下:
http://hi.baidu.com/%C0%E1%B9%FD%CE%DE%BA%DBno1/blog/item/b11e5b186e3143a94aedbc15.html
代码如下:
from win32com.client import Dispatch
import win32com.client
class easyExcel:
"""A utility to make it easier to get at Excel. Remembering
to save the data is your problem, as is error handling.
Operates on one workbook at a time."""
def __init__(self, filename=None):
self.xlApp = win32com.client.Dispatch('Excel.Application')
if filename:
self.filename = filename
self.xlBook = self.xlApp.Workbooks.Open(filename)
else:
self.xlBook &