Create Program to Copy and Paste Text to Clipboard in Python

thumbnail
In this tutorial, you will learn how to create program to copy and paste text to clipboard in python. You need to install pyperclip first using the following command. The source code is show below.
#pip install pyperclip
import pyperclip

text = "Hello World"

pyperclip.copy(text)
#Text copied to clipboard

textfromclipboard = pyperclip.paste()
#paste the clipboard text

print(textfromclipboard)
# 'Hello World'
Back To Top