Skip to content

Python3 clipboard

python3 clipboard wrappers

#### pyperclip
=> cross-platform library, this library can be used on different OS.
import pyperclip
pyperclip.copy(‘The text to be copied to the clipboard.’)
pyperclip.paste()
determine_clipboard()

On Linux, install xclip, xsel, or wl-clipboard (for “wayland” sessions) via package manager.
For example, in Debian:
sudo apt-get install xclip
sudo apt-get install xsel
sudo apt-get install wl-clipboard

pyperclip3
This module is similar to pyperclip, all the methods which is available in pyperclip are also present in this module. The only difference is, it converts every data types to bytes.


import clipboard
clipboard.copy(“abc”) # now the clipboard content will be string “abc”
text = clipboard.paste() # text will have the content of clipboard