Last active
June 24, 2019 05:26
-
-
Save jwenjian/8e672c62eeddb4c56d3014b0f3cfd0ec to your computer and use it in GitHub Desktop.
Copy a string to clipboard using python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyperclip | |
def copy_to_clipboard(command: str): | |
pyperclip.copy(str(command)) | |
if __name__ == '__main__': | |
copy_to_clipboard("Hello, world!") | |
copied_str = pyperclip.paste() | |
print(copied_str) # Hello, world! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment