1 import sys,os
2
3 Usage="""Source indentation converter tab to 4space
4
5 tabTo4Space.py filename
6 """
7 try:
8 fileName = sys.argv[1]
9 except:
10 print Usage
11 sys.exit()
12
13 wFile = open(fileName+'_','w')
14 for line in open(fileName,'r').readlines():
15 newLine=line.replace('\t',' ')
16 wFile.writelines(newLine)
17
18 try:
19 os.rename(fileName+'_',fileName)
20 except:
21 pass