pring怎么把列表的逗号去掉?
python吧
全部回复
仅看楼主
level 3
supermarco 楼主
请教一下
import itertools
a=(1,2,3,4)
for i in itertools.permutations(a,3):
print(str(i))
出来的结果是, 怎样能把打印结果里面的逗号去掉,形成一个数字,例如第一个变成123
(1, 2, 3)
(1, 2, 4)
(1, 3, 2)
(1, 3, 4)
(1, 4, 2)
(1, 4, 3)
(2, 1, 3)
(2, 1, 4)
(2, 3, 1)
(2, 3, 4)
(2, 4, 1)
(2, 4, 3)
(3, 1, 2)
(3, 1, 4)
(3, 2, 1)
(3, 2, 4)
(3, 4, 1)
(3, 4, 2)
(4, 1, 2)
(4, 1, 3)
(4, 2, 1)
(4, 2, 3)
(4, 3, 1)
(4, 3, 2)
2021年12月16日 12点12分 1
level 1
你这是元组啊
2021年12月17日 00点12分 4
level 9
2021年12月17日 02点12分 5
level 14
print(''.join(map(str,i)))
2021年12月17日 03点12分 6
用这个方法打印出来了,谢谢啊
2021年12月17日 11点12分
用这个方法打印出来了,谢谢啊
2021年12月17日 11点12分
level 14
2021年12月17日 03点12分 7
1