Last active
August 29, 2015 14:20
-
-
Save andymitchhank/293eb1c6c665bf15d7ae to your computer and use it in GitHub Desktop.
This file contains 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 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 = open_file.read() | |
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: | |
open_file.write(contents) | |
print "Done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Made my night, thanks!