使用print(*list,sep=",")
含义是输出list的全部内容,不带中括号,并以""中的字符隔开每个元素。
这里元组,字典(字典用不到)也同样合适
sep=","意为在每个元素之间添加,将其隔开
list = [1,2,3,4,5,6,7,8,9] print(*list) 输出1 2 3 4 5 6 7 8 9中间用空格隔开 print(*list,sep=',')输出1,2,3,4,5,6,7,8,9中间用,隔开 print(*list,sep='')输出123456789中间不用任何东西隔开 tuple = ("1","2","3","4","5","6") print(*tuple,sep=',')输出1,2,3,4,5,6