python3 TypeError: cannot concatenate 'str' and 'int' objects)
是不是很奇怪???
我们进一步想想,print输出的前面是字符串组合,后面是列表(python),我们简单点分开写 :
使用 逗号 拼接 这样:
my_foods = ['pizza','falafel','carrot cake','123','第一']
# 打印前三个切片
print("The first three items in the list are:",my_foods[:3])
嗯,就酱!
其实字符串还有很多方式(方法)可以拼接,加油初学者,这中错误很常见(对我们Java学者来说^_^)