Created
November 27, 2012 20:21
-
-
Save pudquick/4156759 to your computer and use it in GitHub Desktop.
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, os.path | |
with open(sys.argv[1]) as f, open(sys.argv[2]) as g: | |
settings = [x for x in f.read().split('\n')] | |
ids = g.read().split() | |
mode = 0 | |
for i, line in enumerate(settings): | |
if line.strip(): | |
if (mode == 0) and line.startswith('[') and (line.strip('[]') in ids): mode = 1 | |
if (mode == 1): settings[i] = ';' + settings[i] | |
else: mode = 0 | |
fname, fext = os.path.splitext(sys.argv[1]) | |
with open(fname + '_out' + fext, 'w') as f: f.write('\n'.join(settings)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment