Jul-31-2023, 07:23 PM
(Jul-31-2023, 07:19 PM)Gribouillis Wrote:(Jul-31-2023, 06:58 PM)lastyle Wrote: max 40 char packets which will be padded by spaces to have a readable resulting text.It seems that you want the built-in textwrap module.
>>> import textwrap >>> s = "The String is from a User Input and can be longer (between 1 and 290 Chars), but i Need to Split the String into max 40 char packets which will be padded by spaces to have a readable resulting text." >>> print(textwrap.fill(s, width=40)) The String is from a User Input and can be longer (between 1 and 290 Chars), but i Need to Split the String into max 40 char packets which will be padded by spaces to have a readable resulting text. >>>
Thanks, that looks what i was searching for.