Created
April 26, 2016 13:08
-
-
Save mperlet/fb00d7a19da816b3412b9c2a0e8ea975 to your computer and use it in GitHub Desktop.
Replace $$key$$ with value in file test.txt with: *python simple_template.py test.txt key=value*
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
import sys | |
content = open(sys.argv[1], 'r').read() | |
for k,v in map(lambda kv:kv.split("="),sys.argv[2:]): | |
content = content.replace('$$%s$$' % k, '%s' % v) | |
print(content) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment