安装




pip3.7 install pyperclip


code




import pyperclip
pyperclip.copy('hello world')
print(pyperclip.paste())


output





Python 3.7.4 (v3.7.4:e09359112e, Jul  8 2019, 14:54:52)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyperclip
>>> pyperclip.copy('hello world')
>>> print(pyperclip.paste())
hello world
>>>