Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (16.4k points)

I've attempted to check out the web for answers to split a string into an array of characters yet I can't locate a basic technique 

str.split(//) doesn't appear to work as Ruby does. Is there a basic method of doing this without looping?

1 Answer

0 votes
by (26.4k points)

You want list.

>>> s = "foobar"

>>> list(s)

['f', 'o', 'o', 'b', 'a', 'r']

Are you searching for a good course to learn python? Join the python course.

Related questions

0 votes
1 answer
asked Jan 5, 2021 in Python by laddulakshana (16.4k points)
0 votes
1 answer
asked Oct 3, 2019 in Python by Sammy (47.6k points)
0 votes
1 answer
0 votes
1 answer
asked Oct 9, 2019 in Python by Sammy (47.6k points)

Browse Categories

...