Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Write a python string to the clipboard via pbcopy (OS X)
def write_to_clipboard(output):
import subprocess
process = subprocess.Popen('pbcopy', env={'LANG': 'en_US.UTF-8'}, stdin=subprocess.PIPE)
process.communicate(output.encode())
@macdet

This comment has been minimized.

Copy link

macdet commented Dec 14, 2018

thx. good job

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.