列表转字符串

 

 列表转字符串

l = ["hi","hello","world"]
print(" ".join(l))

输出:
hi hello world
 

字符串转列表

str1 = "hi hello world"
print(str1.split(" "))

输出

['hi', 'hello', 'world']

 

 
posted @ 2019-03-03 00:17  anobscureretreat  阅读(306)  评论(0)    收藏  举报