python TypeError can only concatenate tuple not str to tuple

缘由分析 这个错误出现是由于执行元组之间的合并 例子 tuple1 = ("str",1,["a","b","c"],4) tuple2 = ("hello",) print(tuple1[0]) print (tuple1[1:3]) print (tuple1[1:]) print (tuple2 * 2) print (tuple1+tuple2) 注意事项,tuple2 的后面有一个逗号
相关文章
相关标签/搜索