I want to make a script that copies all the text from an URL to the clipboard. I have tried to find a solution here, and on other forums, but I have not found anything that answers the question. I am pretty new to Python, so its hard to figure out by myself.
Try the package Pyperclip . Here's an example from their site
import pyperclip
pyperclip.copy('The text to be copied to the clipboard.')
spam = pyperclip.paste()
If you have a variable that stores the URL you can sub that in for the argument in copy. Installation:
pip install pyperclip
clipboard is cross platform (Linux, Mac & Windows), ie:
Install:
pip install clipboard
Usage:
import clipboard
clipboard.copy("abc") # put "abc" on clipboard
cb_text = clipboard.paste() # get clipboard content
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.