Metamorphosis
RSS feed

有个 Python 问题:从字符串 "aa" 至 "mm" 的排列组合打印出来,例如 "aa" "ab" "ac"... "km" "lm" "mm",代码应该怎样写?

import string
a2m = string.lowercase[:13]
print ["%s%s" % (x, y) for x in a2m for y in a2m]
原发布于 https://www.zhihu.com/question/20603887/answer/15609651


published 17 Nov 2012
blog comments powered by Disqus