Python Clipboard

Today, I came across a python library called Pyperclip that provides a cross-platform Python module for copying and pasting text to the clipboard.

Required Packages

Install pyperclip via pip pip install pyperclip

How to access Clipboard using Python

>> import pyperclip

>> pyperclip.copy("Hello world! This is copied to clipboard via pyperclip")   

>> # Now we can paste the text above using ctrl+v or command+v

>> pyperclip.paste()

# Using this paste method we can get the text which is present in the Clipboard

You may get an error message that says: “Pyperclip could not find a copy/paste mechanism for your system. Please see for how to fix this.“”