- 博客(3)
- 收藏
- 关注
原创 word转pdf时python报错:TypeError: This COM object can not automate the makepy process - please run makepy
在执行批量转pdf的脚本时,报错:TypeError: This COM object can not automate the makepy process - please run makepy。查了一些资料说时win32com导致的。报错处:word = gencache.EnsureDispatch(‘Word.Application’)后来将代码改为:word = client.DispatchEx(‘Word.Application’)就不报错了。...
2021-08-05 11:14:18 559
原创 Python find() 方法解释及实例
方法描述:Python find() 方法检测字符串中是否包含子字符串 str ,如果指定 begin(开始) 和 end(结束) 范围,则检查是否包含在指定范围内,如果包含子字符串返回开始的索引值,否则返回-1。语法:str1.find(str2,begin=0,end=len(str2))参数描述:str2:要搜索的字符串。begin:开始索引,默认为0。end:结束索引,默认为字符串的长度。返回值:如果包含子字符串返回开始的索引值,否则返回-1。实例:st
2021-07-19 15:42:19 486 4
原创 如何使用python批量删除文件中的指定多行内容(txt、html都可)
我们工作时会涉及到批量处理很多文件(上千个),写一个批处理程序能够帮助我们提升效率。话不多说直接上代码:import osdel_dir="D:\\test" #要处理文件的目录filelist=os.listdir(del_dir) #提取文件名存放在filelist中for file in filelist: #遍历文件名 del_file=del_dir+'\\'+file #程序和文件不在同一目录下要用绝
2021-07-19 15:11:39 3296 7
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人