I was wondering if python had a built in function similar to
string->list
and list->string
in scheme.
So for example I would like to turn 'abc' into ['a','b','c']
and vice versa using a built in function.
String to list:
>>> list('abc')
['a', 'b', 'c']
List to string:
>>> ''.join(['a', 'b', 'c'])
'abc'
Split using a list comprehension [c for c in theString]
.. and join them again using ''.join(theList)
. Other ways exist.
精彩评论