本人是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 = self.xlApp.Workbooks.Add()
self.filename = ''
def save(self, newfilename=None):
if newfilename:
self.f

在尝试使用Python代码调用win32com.client时遇到'No module named win32com.client'错误。安装pywin32-216.1.win32-py3.2.exe后,问题变为找不到win32api模块。解决方案可能是确保正确安装并配置Python环境,特别是对于Python 3.x版本的依赖库。
最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



