Skip to content

Instantly share code, notes, and snippets.

@patrickserrano
Created August 7, 2017 18:37
Show Gist options
  • Save patrickserrano/ed70d73c5c73ed4ac385ebccc01af104 to your computer and use it in GitHub Desktop.
Save patrickserrano/ed70d73c5c73ed4ac385ebccc01af104 to your computer and use it in GitHub Desktop.
Python script to take input broken by new lines and returns as a comma separated string with each element wrapped in double quotes.
import subprocess
buffer = ''
while True:
line = input()
if not line: break
buffer += '"' + line + '",'
cmd = 'echo '+buffer[:-1].strip()+'|clip'
subprocess.check_call(cmd, shell=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment