Skip to content

Instantly share code, notes, and snippets.

@tdhopper
Created November 25, 2014 14:21
Show Gist options
  • Save tdhopper/671ea1ecdac8d278f461 to your computer and use it in GitHub Desktop.
Save tdhopper/671ea1ecdac8d278f461 to your computer and use it in GitHub Desktop.
Turn whitespace delimited list on clipboard into a Python list object.
#!/usr/bin/env python
import os, json
import subprocess
def get_clipboard():
p = subprocess.Popen(['pbpaste'], stdout=subprocess.PIPE)
retcode = p.wait()
data = p.stdout.read()
return data
cb = get_clipboard()
cb = cb.split()
cb = [w.strip() for w in cb]
print cb,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment