#字符串与列表
#列表转为字符串
list_new = [‘hello’,‘world’,’!’]
str2= ‘’.join(list_new)
print(str2)
#字符串转为列表
str_new = ‘hello,world’
ret1 = str_new.split()
print(ret1)
#列表转为字符串
list_new = [‘string’ ‘is’ ‘string’]
str1 = ‘’
for i in list_new:
str1 += i
print(str1)
python字符串与列表基础
最新推荐文章于 2024-06-12 07:27:50 发布