擅长:python、mysql、java
<p>字典怎么样?</p>
<pre><code>>>> import string
>>> num2alpha = dict(zip(range(1, 27), string.ascii_lowercase))
>>> num2alpha[2]
b
>>> num2alpha[25]
y
</code></pre>
<p>但不要超过26岁:</p>
<pre><code>>>> num2alpha[27]
KeyError: 27
</code></pre>
<hr/>
<p>但是,如果您要查找给定长度的所有字母组合:</p>
<pre><code>>>> import string
>>> from itertools import combinations_with_replacement as cwr
>>> alphabet = string.ascii_lowercase
>>> length = 2
>>> ["".join(comb) for comb in cwr(alphabet, length)]
['aa', 'ab', ..., 'zz']
</code></pre>