Advertisement
rfmonk

textwrap_hanging_ident.py

Dec 30th, 2013
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. import textwrap
  4. from textwrap_example import sample_text
  5.  
  6. dedented_text = textwrap.dedent(sample_text).strip()
  7. print textwrap.fill(dedented_text,
  8.                     initial_indent='',
  9.                     subsequent_indent=' ' * 4,
  10.                     width=50,
  11.                     )
  12. """ $ python textwrap_hanging_ident.py
  13. Traceback (most recent call last):
  14. File "textwrap_hanging_ident.py", line 10, in <module>
  15. width=50,
  16. File "/usr/lib/python2.7/textwrap.py", line 365, in fill
  17. w = TextWrapper(width=width, **kwargs)
  18. TypeError: __init__() got an unexpected keyword argument 'subsequent_ident'
  19. """
  20. # maybe using different version of python?
  21.  
  22. ''' figured it out after running it through ipython
  23. it was a typo! Lines 8 & 9 should say indent instead of ident =]'''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement