Skip to content

Instantly share code, notes, and snippets.

@ddbeck
Created September 7, 2011 21:30
Show Gist options
  • Save ddbeck/1201804 to your computer and use it in GitHub Desktop.
Save ddbeck/1201804 to your computer and use it in GitHub Desktop.
A Thing I Learned About Text Indentation
def indent_test_one():
print """\
Hi,
You'd think this would work nicely, but it doesn't.
- annoyances
- abound
Thanks,
--Daniel"""
def indent_test_two():
print """\
Hi again,
This works, but it ain't pretty.
- bulleted
- lists
- are fun
Not cool,
--Daniel"""
def indent_test_three():
import textwrap
print textwrap.dedent("""\
Hello sir or madam,
What we've got here is nice:
- for
- real
- everybody.
Sincerely,
--Daniel""")
indent_test_one()
print
print '------------------'
print
indent_test_two()
print
print '------------------'
print
indent_test_three()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment