#!/usr/bin/env python
# coding: utf-8
# # Text wrapping in Python
# In[17]:
import textwrap
value = """This function wraps the input paragraph such that each line
in the paragraph is at most width characters long. The wrap method
returns a list of output lines. The returned list
is empty if the wrapped
output has no content."""
# Wrap this text.
wrapper = textwrap.TextWrapper(width=70)
word_list = wrapper.wrap(text=value)
# Print each line.
for element in word_list:
print(element)
#clcoding.com
# In[ ]:
0 Comments:
Post a Comment