How to convert a string to a list of 3 letters words without spaces in Python

1 Answer

0 votes
import textwrap

s = 'python java c c++ rust php c#'
 
lst = textwrap.wrap(s, width=3)
 
print(lst)  
  

  
  
'''
run:

['pyt', 'hon', 'jav', 'a c', 'c++', 'rus', 't', 'php', 'c#']

'''

 



answered Mar 27, 2023 by avibootz

Related questions

1 answer 235 views
1 answer 151 views
1 answer 179 views
1 answer 133 views
1 answer 110 views
...