#format python #!/usr/bin/env python import sys,os Usage="""Source indentation converter tab to 4space tabTo4Space.py filename """ try: fileName = sys.argv[1] except: print Usage sys.exit() wFile = open(fileName+'_','w') for line in open(fileName,'r').readlines(): newLine=line.replace('\t',' ') wFile.writelines(newLine) try: os.rename(fileName+'_',fileName) except: pass