$ python
Python 2.7.12 (default, Nov 20 2017, 18:23:56)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyperclip
>>> pyperclip.copy('The text to be copied to the clipboard.')
例如,正确设置我的剪贴板,但下面的脚本没有,有什么区别?
$ cat example_pyperclip.py
#!/usr/local/bin/python
import pyperclip
pyperclip.copy('The text to be copied to the clipboard.')
print("script is done")
输出
$ python example_pyperclip.py
script is done