我想通过python脚本将一些东西存储到剪贴板中。
它基本上就是pyperclip.copy('text')。我正在使用带有AwesomeWM的Fedora21。我在here上读到,需要一个剪贴板管理器将其永久存储在剪贴板中。我安装了parcellite。如果我在终端中使用它,它现在可以工作,通过
$python
$>>> import pyperclip
$>>> pyperclip.copy('teststring')但是如果我在脚本中做同样的事情
import pyperclip
pyperclip.copy('teststring')并使用python filename执行此脚本。
它不会存储在剪贴板中。
发布于 2016-03-26 07:51:03
它适用于pyperclip-1.5.27。使用此脚本,test.py:
import pyperclip
pyperclip.copy('The text to be copied to the clipboard.')
$>python ./test.py然后执行Ctrl+V粘贴:
The text to be copied to the clipboard.您确定pyperclip.copy正在运行,或者您的脚本比这更复杂吗?
https://stackoverflow.com/questions/36229737
复制相似问题