list>>str
>>>str1 = "abcdefg"
>>>list1 = list(str1)
>>>print(list1)
['a', 'b', 'c', 'd', 'e', 'f', 'g']
>>>str2 = 'hello word'
>>>list2 = str2.split()
>>>print(list2)
['hello', 'word']
>>>str3 = 'www.baidu.com'
>>>list3 = str3.split('.')
>>>print(list3)
['www', 'baidu', 'com']
list>>str
>>>print(''.join(list1))
abcdefg
>>>print(' '.join(list2))
hello word
>>>print('.'.join(list3))
www.baidu.com
参考链接:
https://blog.csdn.net/roytao2/article/details/53433373