Skip to content

Instantly share code, notes, and snippets.

@kzrl
Created November 27, 2012 01:29
Show Gist options
  • Save kzrl/4151809 to your computer and use it in GitHub Desktop.
Save kzrl/4151809 to your computer and use it in GitHub Desktop.
JS Stringify
#!/usr/bin/python
#Very simple way to create long JS string concatenations from each line in a file
#Opens the file given as the first and only argument, and outputs to SDOUT
# + '<contents of the line>'
#Author: Karl Cordes
import sys
try:
in_file = open(sys.argv[1], "r")
except:
sys.exit("ERROR. Can't read supplied filename.")
for line in in_file:
print "+'"+line.rstrip('\n')+"'"
in_file.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment