python自动收集粘贴板

win10的粘贴板可以用“win+V”查看:

每次复制都相当于入栈一个字符串,粘贴相当于获取栈顶。

但是系统自带的这个粘贴板貌似不能一键导出,所以我写了个python代码完成这个功能:

import pyperclip
import time

tmp = ''
while True:
 txt = pyperclip.paste()
 if txt != tmp:
     print(txt)
     tmp=txt
 time.sleep(0.1)

这样,每次复制的内容,都会在python的窗口自动打印出来。

猜你喜欢

转载自blog.csdn.net/nameofcsdn/article/details/132127070
今日推荐