Created
January 15, 2014 01:47
-
-
Save TheNeuralBit/8429347 to your computer and use it in GitHub Desktop.
Simple script for taking a file with a bunch of long lines and breaking it into 80 character lines - I use it to fix the output of http://fuckyeahmarkdown.com
This file contains hidden or 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
import sys | |
infile = open(sys.argv[1], 'r') | |
outfile = open(sys.argv[2], 'w') | |
for line in infile.read().split('\n'): | |
while len(line) > 80: | |
idx = line[:80].rfind(' ') | |
outfile.write('%s\n' % line[:idx]) | |
line = line[idx + 1:] | |
outfile.write('%s\n' % line) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment