Created
November 25, 2014 14:21
-
-
Save tdhopper/671ea1ecdac8d278f461 to your computer and use it in GitHub Desktop.
Turn whitespace delimited list on clipboard into a Python list object.
This file contains hidden or 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
#!/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