You are viewing a single comment's thread. Return to all comments →
Without textwrap module
def wrap(string, max_width): new_str = '' ind_width = [] for i in range(len(string)): if (i+1)%max_width == 0: new_str = new_str + string[i-(max_width-1):i+1]+'\n' ind_width.append(i+1) new_str = new_str+string[max(ind_width):] return new_str
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 →
Without textwrap module