Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I was wondering if python had a built in function similar to
string->list
and list->string in scheme.
list->string
So for example I would like to turn 'abc' into ['a','b','c'] and vice versa using a built in function.
['a','b','c']
String to list:
>>> list('abc') ['a', 'b', 'c']
List to string:
>>> ''.join(['a', 'b', 'c']) 'abc'
Add a comment
Split using a list comprehension [c for c in theString] .. and join them again using ''.join(theList). Other ways exist.
[c for c in theString]
''.join(theList)
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.