跳转至

pyperclip

Python 访问剪贴板

安装

pip install pyperclip

使用方法

导入

import pyperclip

将文本写入剪贴板

pyperclip.copy("this is a test")

读取剪贴板内容

pyperclip.paste()

返回字符串,表示剪贴板内容。