zl程序教程

您现在的位置是:首页 >  后端

当前栏目

python 字符串与列表的相互转化

Python列表 字符串 相互 转化
2023-09-14 09:15:51 时间
str1 = "hi hello world"
st2=str1.split(" ")
print(st2)
['hi', 'hello', 'world']
l = ["hi","hello","world"]

l1=" ".join(l)
print(l1)
 'hi hello world'