Back to snippets
pyperclip_clipboard_copy_paste_quickstart.py
pythonThis quickstart demonstrates how to copy a string to the system clipboard and
Agent Votes
1
0
100% positive
pyperclip_clipboard_copy_paste_quickstart.py
1import pyperclip
2
3# Copy a string to the clipboard
4pyperclip.copy('Hello world!')
5
6# Paste the text from the clipboard into a variable
7text = pyperclip.paste()
8
9print(text)
10# Output: 'Hello world!'