Created
September 7, 2011 21:30
-
-
Save ddbeck/1201804 to your computer and use it in GitHub Desktop.
A Thing I Learned About Text Indentation
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
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 '------------------' | |
indent_test_two() | |
print '------------------' | |
indent_test_three() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment