我想使用 python 访问剪贴板内容。我正在使用下面的 python 脚本来执行操作。
from tkinter import Tk
r = Tk()
result = r.selection_get(selection="CLIPBOARD")
print(result)
上面的代码片段有助于获取当前剪贴板中可用的内容。我的要求是完全获取剪贴板历史记录。
关于此的任何建议都将非常有帮助。
最佳答案
使用名为 pyperclip
的外部模块
import pyperclip
pyperclip.copy("abc") # now the clipboard content will be string "abc"
text = pyperclip.paste() # text will have the content of clipboard
关于python - 使用python的剪贴板历史记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43313513/