Skip to content

Instantly share code, notes, and snippets.

Last active December 20, 2015 11:38
What would you like to do?
split a comma separated string, print it as a quoted tuple. example: $ ./ FRNG, MONU, TOWR, TREE ('FRNG', 'MONU', 'TOWR', 'TREE')
#!/usr/bin/env python
import sys
quoted_items = []
for string in sys.argv[1:]:
items = string.split(", ")
[quoted_items.append("'%s'" % i.replace(",","")) for i in items]
print "(" + ", ".join(quoted_items) + ")"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment