首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >Python剪贴板的Ctrl+c与Ctrl+v

Python剪贴板的Ctrl+c与Ctrl+v

作者头像
红目香薰
发布2022-11-30 19:10:15
发布2022-11-30 19:10:15
2.7K0
举报
文章被收录于专栏:CSDNToQQCodeCSDNToQQCode

代码示例:

代码语言:javascript
复制
#导入模块
import pyperclip
 
# 将字符串复制到剪贴板
pyperclip.copy('字符串内容')
 
# 从剪贴板粘贴复制数据
pyperclip.paste()

这里需要环境

环境安装有需要注意的内容:

如果是测试开发环境【pip install pyperclip】

系统中安装就得使用【python -m pip install pyperclip】

系统中也就是所谓的cmd内使用即可。

执行某python文件的bat文件示例:

chcp 65001 title '短网址解析长网址' echo off cls python shortToLong.py echo "信息已复制到粘贴板,直接Ctrl+V即可。" pause

中间的python 执行文件.py就是咱们的代码内容,内容中可以使用读取文件以及整理数据的方式将需要粘贴的字符串进行格式化。

字符串示例:

#接龙 http://t.csdn.cn/DWodz 1. CSDN-亮点 http://t.csdn.cn/DWodz 2. 不知名白帽  http://t.csdn.cn/YO6Sm 3. 编程爱好者-阿新 http://t.csdn.cn/4suuN 4. 一一哥 https://yiyige.blog.csdn.net/article/details/120990448 5. 执久 http://t.csdn.cn/4UCQf 6. 花神庙码农@CSDN http://t.csdn.cn/t9moE 7. 木木 http://t.csdn.cn/aalnU 8. 挽·烽 http://t.csdn.cn/LaZIz 高质量三连回访 9. 六月暴雪飞梨花 http://t.csdn.cn/VqL0s 10. 风铃听雨~ http://t.csdn.cn/9fkAT 11. 东非不开森 http://t.csdn.cn/fZa8s 开学季征文 如有时间愿意看的,可以指点一下嘿嘿 谢谢啦🥰🥰 12. 小明java问道之路 经验文 | 编程的上帝视角是什么?感兴趣的可以看看 http://t.csdn.cn/ffDdq 硬核深度文 | 精通内核-CPU控制并发原理CPU中断控制 http://t.csdn.cn/UZ6kN 💖在线求个一键三连💖 13. AKA|布鲁克林欧神仙 https://blog.csdn.net/m0_54594153/article/details/126661839?spm=1001.2014.3001.5501高质量三连回访 14. 阿提说说 http://t.csdn.cn/K3KSU 15. DDD666🍭 http://t.csdn.cn/2zn4R 16. 付文龙(爱吃回锅肉)红目香薰 http://t.csdn.cn/kqcPv 17. Bourne http://t.csdn.cn/ndJvc 18. 秦羽 http://t.csdn.cn/nn0cO 19. 宁采桃花不采臣 http://t.csdn.cn/nqgEK 2.​Code For Better 20. CSDN-北极的三哈 http://t.csdn.cn/Zn1WF 21. promise https://blog.csdn.net/m0_71485750/article/details/126427221  互三互粉 22. Beyond https://blog.csdn.net/chuxinchangcun/article/details/126681915

优化到剪贴板数据:

 https://blog.csdn.net/CSDN_anhl/article/details/126240868 https://blog.csdn.net/m0_63127854/article/details/126682845 https://blog.csdn.net/m0_47419053/article/details/126679490 https://yiyige.blog.csdn.net/article/details/120990448 https://blog.csdn.net/weixin_60719453/article/details/126674166 https://blog.csdn.net/qxhgd/article/details/115391385 https://blog.csdn.net/m0_64102491/article/details/126673956 https://blog.csdn.net/Fire_Cloud_1/article/details/126669683 https://blog.csdn.net/L_Lycos/article/details/126614374 https://blog.csdn.net/muzi_longren/article/details/126654597 https://blog.csdn.net/m0_62159662/article/details/126653214 https://blog.csdn.net/FMC_WBL/article/details/126683043 https://blog.csdn.net/FMC_WBL/article/details/126575914 https://blog.csdn.net/m0_54594153/article/details/126661839 https://blog.csdn.net/weixin_40972073/article/details/126682094 https://blog.csdn.net/BIT_666/article/details/126656554 https://blog.csdn.net/feng8403000/article/details/126674232 https://blog.csdn.net/qq_44631587/article/details/126667516 https://blog.csdn.net/qq_43585922/article/details/126685211 https://blog.csdn.net/m0_65909361/article/details/126599073 https://blog.csdn.net/m0_68744965/article/details/126471630 https://blog.csdn.net/m0_71485750/article/details/126427221 https://blog.csdn.net/chuxinchangcun/article/details/126681915

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022-09-04,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档