Pyperclip

The pyperclip module is used to copy text to the clipboard. The copy() function copies a given text to the clipboard, and the paste() function retrieves the most recently copied text. This module is not in the default package, so we have to install it as shown here.


import pyperclip
pyperclip.copy("Hello World!")
print(pyperclip.paste())