Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 25 lines (20 sloc) 0.619 kb
import sys, glob
def read_fileb(filename, mode='rb'):
f = open(filename, mode)
try:
return f.read()
finally:
f.close()
def write_fileb(filename, value, mode='wb'):
f = open(filename, mode)
try:
f.write(value)
finally:
f.close()
for filename in glob.glob(sys.argv[1]):
data1 = read_fileb(filename)
write_fileb(filename + '.bak2', data1)
data2lines = read_fileb(filename).split('\n')
data2 = '\n'.join([line.rstrip().replace('\t',' '*2) for line in data2lines])+'\n'
write_fileb(filename, data2)
print filename, len(data1)-len(data2)
Jump to Line
Something went wrong with that request. Please try again.