Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import os
# your xcode project directory
directory = ''
for root, _, files in os.walk(directory):
for f in files:
edited = False
fullpath = os.path.join(root, f)
with open(fullpath, 'r') as open_file:
contents =
if contents[:3] == "'''" or contents[:3] == '"""':
edited = True
contents = "#dummycomment\n" + contents
if contents[:2] == '#!':
edited = True
contents = contents.splitlines(True)
contents[0] = '#dummycomment\n'
contents = ''.join(contents)
if edited:
with open(fullpath, 'w') as open_file:
print "Done"
Copy link

highfestiva commented May 9, 2015

Made my night, thanks!

Copy link

fedry commented May 13, 2015

Thank you so much! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment