Clipboard Copy In Python

Clipboard Copy In Python

Published on July 21 2021

In this tutorial, you will learn how to copy data to clipboard in Python using the pyperclip module and pandas library. We will understand both methods in detail with examples.

Source Code

# Method 1- using pyperclip module
# pip install pyperclip
# pip3 install pyperclip

import pyperclip
pyperclip.copy('data from clipboard.')
print(pyperclip.paste())

# Method 2- using pandas module
# pip install pandas
# pip3 install pandas

import pandas as pd
df = pd.DataFrame(['data from clipboard using pandas'])
df.to_clipboard()
print(pd.read_clipboard())

Video