Skip to content

Instantly share code, notes, and snippets.

@XuankangLin
Created December 19, 2013 16:00
Show Gist options
  • Select an option

  • Save XuankangLin/8041594 to your computer and use it in GitHub Desktop.

Select an option

Save XuankangLin/8041594 to your computer and use it in GitHub Desktop.
Copy to clipboard in mac os x (in python)
import subprocess
def setClipboardData(data):
p = subprocess.Popen(['pbcopy'], stdin=subprocess.PIPE)
p.stdin.write(data)
p.stdin.close()
retcode = p.wait()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment