Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我想将字符串转换'ABCD'为列表['A','B','C','D'],最简单的方法是什么?
'ABCD'
['A','B','C','D']
我能想到的最简单的一个:
>> list('ABCD') ['A', 'B', 'C', 'D']
参考:
根据您的用例,您甚至可能不必这样做 - 字符串已经是可迭代的:
for c in "ABCD" print c
印刷
A B C D