键盘组合键
Ctrl+可以
C复制大多数应用程序中突出显示的内容,应该可以正常使用。这部分很容易使用
pyautogui。对于编程获取剪贴板内容,如其他人所说,你可以用它实现
ctypes,
pywin32或者其他库。在这里,我选择了
pyperclip:
import pyautogui as pyaimport pyperclip # handy cross-platform clipboard text handlerimport timedef copy_clipboard(): pya.hotkey('ctrl', 'c') time.sleep(.01) # ctrl-c is usually very fast but your program may execute faster return pyperclip.paste()# double clicks on a position of the cursorpya.doubleClick(pya.position())list = []var = copy_clipboard()list.append(var) print(list)


