Skip to content

Instantly share code, notes, and snippets.

@tehmaze

tehmaze/asciifix.py

Created Aug 18, 2015
Embed
What would you like to do?
Fix broken ASCIIs interpreted as ANSi by PabloDraw
#!/usr/bin/python
import sys
lines = []
overflow = False
with open(sys.argv[1]) as i:
for line in i:
line = line.rstrip('\r\n')
if overflow:
lines.append(lines.pop(len(lines) - 1) + line)
else:
lines.append(line)
overflow = len(line) >= 80
print '\n'.join(lines)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment