2
0

removetrailingwhitespace.py.in 295 B

1234567891011121314
  1. #!@PYTHONEXE@
  2. import sys
  3. import re
  4. for fileName in sys.argv[1:]:
  5. f = open(fileName, 'r+')
  6. fileString = f.read()
  7. fileString = re.sub(r'[ ]+\n', r'\n', fileString)
  8. fileString = re.sub(r'\r', r'', fileString)
  9. f.seek(0)
  10. f.write(fileString)
  11. f.truncate(len(fileString))