2014-09-21 50 views
-2

我正在使用python(版本2.7),並且我有一個名爲characters('abc123')的變量。我希望能夠分割它,以便我有變量中的字符列表(['a','b','c','1','2','3'])。有誰知道如何做到這一點?Python可變字符分割

+1

http://stackoverflow.com/questions/113655/is-there-a-function-in-python-to-split-a-word-into-a-list – 2014-09-21 14:58:57

回答

0
s = 'abc123' 

>>> list(s) 
['a', 'b', 'c', '1', '2', '3'] 
+0

謝謝!這有很大幫助。 – OscarPi 2014-09-21 15:56:39