擅长:python、mysql、java
<pre><code>import textwrap
def f1(foo):
return iter(foo.splitlines())
long_str = """
123456789 123456789 123456789 123456789 123456789 123456789
Line 1: Artificial intelligence (AI), sometimes called machine intelligence,
Line 2: is intelligence demonstrated by machines,
Line 3: in contrast to the natural intelligence displayed by humans and other animals.
Line 4: In computer science AI research is defined as
"""
[print('\n'.join(textwrap.wrap(l, 64, break_long_words=False))) for l in f1(long_str)]
</code></pre>
<p><em>每<a href="https://stackoverflow.com/q/3054604/7322095">this</a></em></p>