python输出列表去掉中括号

可以使用.join的方法进行输出,因为.join处理的是字符串,所以需要进行类型转换

list1=[1,2,3]
print((',').join(str(x) for x in list1))

你可能感兴趣的:(Python,python)