如何将字符串字符转换为列表?
问题描述:
可能重复:
如何创建带有以下字符的列表字符串?
Possible Duplicate:
How to create a list with the characters of a string?
示例:
'abc'
成为
['a', 'b', 'c']
它是分割和切片的组合吗?
Is it a combination of split and slicing?
答
>>> x = 'abc'
>>> list(x)
['a', 'b', 'c']
不确定要执行的操作,但是可以从字符串本身访问单个字符:
Not sure what you are trying to do, but you can access individual characters from a string itself:
>>> x = 'abc'
>>> x[1]
'b'