Skip to content

Instantly share code, notes, and snippets.

@pudquick pudquick/
Created Nov 27, 2012

What would you like to do?
import sys, os.path
with open(sys.argv[1]) as f, open(sys.argv[2]) as g:
settings = [x for x in'\n')]
ids =
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
You can’t perform that action at this time.