Created
April 6, 2016 07:15
-
-
Save curzona/f827281a06f1acb516907abca4f961fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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