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 223 views
1 answer 143 views
1 answer 159 views
1 answer 119 views
1 answer 99 views
...