How to convert a string to a list of characters without spaces in Python

1 Answer

0 votes
import textwrap

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

  
  
'''
run:

['p', 'y', 't', 'h', 'o', 'n', 'j', 'a', 'v', 'a', 'c', 'c', '+', '+', 'r', 'u', 's', 't']

'''

 



answered Mar 27, 2023 by avibootz
...