![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
应用
学技术的翻译小白
记录生活,记录python学习之路。
展开
-
同一文件夹下多个word文档合并
引用链接import os# 输入输出函数,用来获取目录路径import win32com.client as win32word = win32.gencache.EnsureDispatch('Word.Application')# 启动word对象应用word.Visible = Falsepath = r'C:\Users\Laurence\Desktop\大创\删改后的语料(外)'# 需要合并的文件所在路径files = []filename = os.listdir(pat原创 2021-12-08 16:51:07 · 532 阅读 · 0 评论 -
Python接入百度通用翻译API(英中)
import http.clientimport hashlibimport urllibimport randomimport jsondef baidu(kw): appid = '' # 填写你的appid secretKey = '' # 填写你的密钥 httpClient = None myurl = '/api/trans/vip/translate' fromLang = 'auto' # 原文语种 toLang = 'z原创 2021-01-23 11:36:28 · 448 阅读 · 0 评论 -
计算原文(txt格式)中某一单词出现的次数
文件名与代码放在同一路径下def count_word(filename, word): try: with open(filename, encoding='UTF-8') as f: lines = f.readlines() txt_string = '' for line in lines: txt_string += line.rstrip() except FileNotFou.原创 2020-12-29 16:43:10 · 270 阅读 · 0 评论