Skip to content

Instantly share code, notes, and snippets.

@curzona
Created April 6, 2016 07:15
Show Gist options
  • Save curzona/f827281a06f1acb516907abca4f961fa to your computer and use it in GitHub Desktop.
Save curzona/f827281a06f1acb516907abca4f961fa to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import argparse
import re
def parse_args(args=None):
parser = argparse.ArgumentParser()
parser.add_argument('input')
parser.add_argument('output')
args = parser.parse_args(args)
return args
def main(args=None):
args = parse_args(args)
text = open(args.input, 'rb').read()
text = re.sub(r"[ \t]*(\r?\n)", r"\1", text)
open(args.output, 'wb').write(text)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment