How to split a string into array of characters?


Question

I've tried to look around the web for answers to splitting a string into an array of characters but I can't seem to find a simple method

str.split(//) does not seem to work like Ruby does. Is there a simple way of doing this without looping?

1
401
11/5/2017 9:28:52 PM

>>> s = "foobar"
>>> list(s)
['f', 'o', 'o', 'b', 'a', 'r']

You need list

791
2/12/2011 3:16:17 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon