一、字符串string转换为列表list
(1)L=list(S):将字符串S转换为列表L,返回列表
(2)L=S.split(" "):将字符串S以空格进行切分,返回列表L
二、列表list转换为字符串string
(1)S=str.join(L):将列表L(元素均为字符串)以str连接为字符串S,返回字符串
a=list("wahoo!")
print(a) # ["wahoo!"]
a="How are you doing today?".split(" ")
print(a) # ["How","are","you","doing","today"]
s=" ".join(a)
print(s) # "How are you doing today?"
a=["parsley"," ","is"," ","gharsley"]
s="".join(a)
print(s) # "parsley is gharsely"