textwrap模块的作用
格式化文本段落,需要美观打印的情况下,可以使用textwrap模块格式化要输出的文本。它提供了很多文本编辑器和字处理器中都有段落自动换行或填充特性。
1、演示的数据
sample_text = ''' The textwrap module can be used to format text for output in situations where pretty-printing is desired. It offers programmatic functionality similar to the paragraph wrapping or filling features found in many text editors. '''