Ho una stringa lunga che vorrei spezzettare, di max caratteri X. MA, solo in uno spazio (se qualche parola nella stringa è più lunga di X caratteri, basta metterla nel suo pezzo).Dividere una stringa in pezzi di lunghezza massima X - dividere solo negli spazi
io non so nemmeno come iniziare a fare questo ... Pythonically
pseudo codice:
declare a list
while still some string left:
take the fist X chars of the string
find the last space in that
write everything before the space to a new list entry
delete everything to the left of the space
Prima che il codice che fino, c'è qualche modulo python che mi può aiutare (Non penso che lo pprint possa)?
Ho da poco scoperto che Python ha una [textwrap] (https://docs.python.org/3.5/ library/textwrap.html # module-textwrap) module;) – swenzel