MobileBlur

Artifact [5a7fce32f0]
Login

Artifact [5a7fce32f0]

Artifact 5a7fce32f03c5e1e177b4ca4b6a5b0cbe16ec34f:


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() for line in data2lines])+'\n'
    write_fileb(filename, data2)
    print filename, len(data1)-len(data2)