python列表只有字符串可以用join链接,如果含有数字用for循环


li = ['aa', 'dd']
a = ''.join(li)
print(a)
li = [123, "aaa"]
s = ""
for i in li:
s = s + str(i)
print(s)

猜你喜欢

转载自www.cnblogs.com/tootise/p/9073135.html