1 #encoding: utf-8 2 3 # 作业:请用代码实现:利用下划线将列表的每个元素拼接成字符串,li=["alex","eric","rain"] 4 5 li = ["alex", "eric", "rain"] 6 a = li[0] 7 8 for i in li[1:]: 9 a += "_" + i 10 11 print(a)
1 #encoding: utf-8 2 3 # 作业:请用代码实现:利用下划线将列表的每个元素拼接成字符串,li=["alex","eric","rain"] 4 5 li = ["alex", "eric", "rain"] 6 a = li[0] 7 8 for i in li[1:]: 9 a += "_" + i 10 11 print(a)