Skip to content

Instantly share code, notes, and snippets.

@shyang
Created May 5, 2012 18:17
Show Gist options
  • Save shyang/2604500 to your computer and use it in GitHub Desktop.
Save shyang/2604500 to your computer and use it in GitHub Desktop.
Convert old style separator for new Xcode.
#! /usr/bin/env python3
'''Convert old style separator for new Xcode.'''
import re
import sys
for file in sys.argv:
with open(file, 'rw') as f:
source = f.read()
source, n = re.subn(r'^(\#pragma mark -\n\#pragma mark (.*))$', r'#pragma mark - \2', source, flags=re.M)
if n:
f.write(source)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment