September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
40
Task/Word-wrap/Python/word-wrap.py
Normal file
40
Task/Word-wrap/Python/word-wrap.py
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
>>> import textwrap
|
||||
>>> help(textwrap.fill)
|
||||
Help on function fill in module textwrap:
|
||||
|
||||
fill(text, width=70, **kwargs)
|
||||
Fill a single paragraph of text, returning a new string.
|
||||
|
||||
Reformat the single paragraph in 'text' to fit in lines of no more
|
||||
than 'width' columns, and return a new string containing the entire
|
||||
wrapped paragraph. As with wrap(), tabs are expanded and other
|
||||
whitespace characters converted to space. See TextWrapper class for
|
||||
available keyword args to customize wrapping behaviour.
|
||||
|
||||
>>> txt = '''\
|
||||
Reformat the single paragraph in 'text' to fit in lines of no more
|
||||
than 'width' columns, and return a new string containing the entire
|
||||
wrapped paragraph. As with wrap(), tabs are expanded and other
|
||||
whitespace characters converted to space. See TextWrapper class for
|
||||
available keyword args to customize wrapping behaviour.'''
|
||||
>>> print(textwrap.fill(txt, width=75))
|
||||
Reformat the single paragraph in 'text' to fit in lines of no more than
|
||||
'width' columns, and return a new string containing the entire wrapped
|
||||
paragraph. As with wrap(), tabs are expanded and other whitespace
|
||||
characters converted to space. See TextWrapper class for available keyword
|
||||
args to customize wrapping behaviour.
|
||||
>>> print(textwrap.fill(txt, width=45))
|
||||
Reformat the single paragraph in 'text' to
|
||||
fit in lines of no more than 'width' columns,
|
||||
and return a new string containing the entire
|
||||
wrapped paragraph. As with wrap(), tabs are
|
||||
expanded and other whitespace characters
|
||||
converted to space. See TextWrapper class
|
||||
for available keyword args to customize
|
||||
wrapping behaviour.
|
||||
>>> print(textwrap.fill(txt, width=85))
|
||||
Reformat the single paragraph in 'text' to fit in lines of no more than 'width'
|
||||
columns, and return a new string containing the entire wrapped paragraph. As with
|
||||
wrap(), tabs are expanded and other whitespace characters converted to space. See
|
||||
TextWrapper class for available keyword args to customize wrapping behaviour.
|
||||
>>>
|
||||
Loading…
Add table
Add a link
Reference in a new issue