我想让我的代码输出不带括号和逗号:
import itertools
import pprint
run = 1
while run != 0:
number = raw_input('\nPlease type between 4 and 8 digits and/or letters to run permutation: ')
if len(number) >= 4 and len(number) <= 8:
per = list(itertools.permutations(number))
pprint.pprint(per)
print '\nNumber of possible combinations: ',len(per),'\n'
elif number == 'exit':
run = 0
else:
raw_input('length must be 4 to 8 digits and/or letters. Press enter to exit')
run = 0
因此,它会在新行中打印出每个组合的列表。如何在没有括号和逗号的情况下打印它?我仍然希望能够调用 per[x] 来获得某种组合。任何帮助表示赞赏!谢谢你。