Created
November 27, 2012 01:29
-
-
Save kzrl/4151809 to your computer and use it in GitHub Desktop.
JS Stringify
This file contains 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/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