You are viewing a single comment's thread. Return to all comments →
import textwrap
def wrap(string, max_width): wrapper = textwrap. TextWrapper (max_width) word_list = wrapper.wrap(text=string)
for i in word_list: print(i)
if name == 'main': string, max_width = input(), int(input()) result = wrap(string, max_width) print(resul`t)
My output is coming out as: ABCD EFGH IJKL IMNO QRST UVWX YZ None
Can anybody help?
Seems like cookies are disabled on this browser, please enable them to open this website
Text Wrap
You are viewing a single comment's thread. Return to all comments →
import textwrap
def wrap(string, max_width): wrapper = textwrap. TextWrapper (max_width) word_list = wrapper.wrap(text=string)
for i in word_list: print(i)
if name == 'main': string, max_width = input(), int(input()) result = wrap(string, max_width) print(resul`t)
My output is coming out as: ABCD EFGH IJKL IMNO QRST UVWX YZ None
Can anybody help?