Skip to content

Instantly share code, notes, and snippets.

@kgleeson
Created July 17, 2012 19:48
Show Gist options
  • Save kgleeson/3131580 to your computer and use it in GitHub Desktop.
Save kgleeson/3131580 to your computer and use it in GitHub Desktop.
import sys
import re
file = sys.argv[1]
with open(file, 'rU') as f:
text = f.read()
text = re.sub('[\s]{2,10}', ' ', text)
with open(file+'.new', 'w') as f:
f.write(text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment