博客
关于我
文献复制去换行 python
阅读量:346 次
发布时间:2019-03-04

本文共 995 字,大约阅读时间需要 3 分钟。

import timeimport sysimport osimport resys.path.append(os.path.abspath("SO_site-packages"))import pyperclip# 文献复制中英结合版# 版本 0.4# 作者:TophTab# 支持我通过支付宝二维码,即使一元也对作者支持recent_value = ""tmp_value = ""# 字符转换表(英文到中文)E_pun = u',.!?()《》“’"C_pun = u',。!?()《》“’'table_CtoE = {ord(f):ord(t) for f, t in zip(C_pun, E_pun)}table_EtoC = {ord(f):ord(t) for f, t in zip(E_pun, C_pun)}def English(recent_value):    changed_1 = re.sub(r"\s{2,}", " ", recent_value)    pyperclip.copy(changed_1)    print("英文值变为: %s" % changed_1)    time.sleep(0.1)def Chinese(recent_value):    changed_1 = re.sub(r"\s", "", recent_value)    pyperclip.copy(changed_1)    print("中文值变为: %s" % changed_1)    time.sleep(0.1)while True:    tmp_value = pyperclip.paste()    try:        if tmp_value != recent_value:            recent_value = tmp_value            if re.search(u"[\u2E80-\u9FFF]+", tmp_value):                Chinese(recent_value)            else:                English(recent_value)    except KeyboardInterrupt:        break

转载地址:http://ufrq.baihongyu.com/

你可能感兴趣的文章
NOIP2014 提高组 Day2——寻找道路
查看>>
NOIp模拟赛二十九
查看>>
NOPI读取Excel
查看>>
NoSQL&MongoDB
查看>>
NoSQL介绍
查看>>
Notepad++在线和离线安装JSON格式化插件
查看>>
NotImplementedError: Cannot copy out of meta tensor; no data! Please use torch.nn.Module.to_empty()
查看>>
Now trying to drop the old temporary tablespace, the session hangs.
查看>>
np.arange()和np.linspace()绘制logistic回归图像时得到不同的结果?
查看>>
npm error MSB3428: 未能加载 Visual C++ 组件“VCBuild.exe”。要解决此问题,1) 安装
查看>>
npm install digital envelope routines::unsupported解决方法
查看>>
npm install 卡着不动的解决方法
查看>>
npm install 报错 ERR_SOCKET_TIMEOUT 的解决方法
查看>>
npm install 报错 no such file or directory 的解决方法
查看>>
npm install报错,证书验证失败unable to get local issuer certificate
查看>>
npm install无法生成node_modules的解决方法
查看>>
npm install的--save和--save-dev使用说明
查看>>
npm node pm2相关问题
查看>>
npm run build 失败Compiler server unexpectedly exited with code: null and signal: SIGBUS
查看>>
npm run build报Cannot find module错误的解决方法
查看>>