Created
May 22, 2013 02:31
-
-
Save alenbasic/5624875 to your computer and use it in GitHub Desktop.
When helping a friend with his code I kept having issues modifying it because of tabs/spaces (my text editors convert tabs to spaces while his doesn't) so I created this script so that I could quickly convert his tabs to spaces.
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 re; from sys import argv | |
# start the program like this: | |
# python tabs2spaces.py file_name_to_change.extension | |
file_name = argv[1] | |
read = open(file_name,'r+').read() | |
update = re.sub("[\t]", ' ', read) | |
save = open(file_name, 'w') | |
save.write(update) | |
save.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment