textwrap模块

fill  将多行文本按照指定的宽度和格式输出

s = "Look into my eyes, look into my eyes, the eyes, the eyes, \
the eyes, not around the eyes, don't look around the eyes, \
look into my eyes, you're under."

import textwrap
print(textwrap.fill(s, 70))
print(textwrap.fill(s, 40, initial_indent='    ', subsequent_indent='    '))

 

你可能感兴趣的:(textwrap模块)