有个python问题:从字符串“aa"至”mm"的排列组合打印出来

2024-12-17 13:56:09
推荐回答(2个)
回答1:

for i in range(97,110): #97为ASCII中a代码,109为m
for j in range(97,110):
print unichr(i)+unichr(j)

回答2:

alp_set = range(ord('a'), ord('m')+1):
for i in alp_set:
print [join(chr(i),chr(j)) for j in alp_set]