Python : 将字符串拆分为单个字母所组成的列表并合并单个字母

字符串拆分成由单个字母组成的列表:

string="asdasd"
print(list(string))

输出:
['a', 's', 'd', 'a', 's', 'd']

将单个字母组成的列表进行合并:

string="asdasd"
print(list(string))
string_two=list(string)
print("".join(string_two))

输出:

['a', 's', 'd', 'a', 's', 'd']
asdasd

 

得解。

posted @ 2020-05-11 15:54  Geeksongs  阅读(15996)  评论(0编辑  收藏  举报

Coded by Geeksongs on Linux

All rights reserved, no one is allowed to pirate or use the document for other purposes.