python 模块 pyperclip 操作剪切板


python pyperclip 模块可实现操作剪切板,下面的示例实现获取当前剪切板内容,在获取到的内容前添加“hello:”后再复制到剪切板:

import pyperclip

# 获取剪切板内容到 last_string
clipcontent = pyperclip.paste()
if clipcontent:
    # 将 'hello:' + last_string 复制到剪切板
    pyperclip.copy('hello:' + clipcontent)


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM