正文共:1531 字 8 图
预计阅读时间: 4 分钟
每次翻译外文文献的时候,把英文复制到谷歌翻译,会出现PDF格式的文本的换行很麻烦,需要手动来删除换行,影响翻译时思考的质量。
想起最近学的python编程,我可不可以用python来解决这个问题呢?
答案是:经过2个小时的努力,可以了。
在公众号服务窗口,输入: 翻快点
即可得到所需安装包及文件。
安装完python3.6.5.exe后,搜索 idle.exe 并打开。
新建文件(New File ),输入
with open('etext.txt','r') as fp:
data = fp.readlines()
data = [line.strip() for line in data]
data = ','.join(data)
data = data.split(',')
data = ' '.join(map(str,data))
with open('welltext.txt','w') as fp:
fp.write(data)
即成了这样
将你复制的PDF格式的文字,粘贴到自己新建的 etext.txt文件
按 F5 运行这个程序代码(即 run module)
就可以得到连续一行格式的 welltext.txt文件了
例子:
这样就能将
- It is widely recognized that a visual texture, which humans
- can easily perceive, is very difficult to define [17]. The difficulty
- results mainly from the fact that different people can define textures
- in application-dependent ways or with different perceptual
- motivations, and there is no generally agreed-upon definition
- [44]. It is not our intention to add here a new one: we simply
- observe that it should be as general as possible, because a too
- strict definition would allow one to confine his/her work to images
- that better fit with it, eventually leading to narrow-domain
- solutions.
转换成
- It is widely recognized that a visual texture which humans can easily perceive is very difficult to define [17]. The difficulty results mainly from the fact that different people can define textures in application-dependent ways or with different perceptual motivations and there is no generally agreed-upon definition [44]. It is not our intention to add here a new one: we simply observe that it should be as general as possible because a too strict definition would allow one to confine his/her work to images that better fit with it eventually leading to narrow-domain solutions.
在谷歌翻译里就是从这样
到这样
出大拇指,长按二维码,点击关注哦!
在公众号服务窗口,输入: 翻快点
即可得到所需安装包及文件。
公众号:逻辑熊猫