Skip to content

Instantly share code, notes, and snippets.

@ericabell
Created March 3, 2017 17:55
Show Gist options
  • Save ericabell/77b667b66b1ed89ecb040cf39835b098 to your computer and use it in GitHub Desktop.
Save ericabell/77b667b66b1ed89ecb040cf39835b098 to your computer and use it in GitHub Desktop.
fix word wrap in file
import textwrap
f = open('sample_input_text.asc','r')
contents = f.read()
split_contents = contents.splitlines()
for line in split_contents:
dedent_line = textwrap.dedent( line )
print( textwrap.fill(dedent_line, width=60))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment