Take the 2-minute tour ×

The alphabet (and its indices) can be found here:


Is there a shorter way than alphabet = ['A','B',...] of representing this alphabet?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

You can use the string module

import string
alphabet = string.ascii_uppercase + string.ascii_lowercase + string.digits + '+/'
share|improve this answer
The import more than chews up any gains of not typing it out. –  Ignacio Vazquez-Abrams Feb 5 '13 at 7:16
@IgnacioVazquez-Abrams You're right - but it's a bit more modular (which, in this case, I don't need). EDIT: Modular in the sense of rearranging your alphabet if so needed. –  sdasdadas Feb 5 '13 at 7:23
I prefer this answer, but: what about string.digits and "+/"? Complete would be alphabet = string.ascii_uppercase + string.ascii_lowercase + string.digits + "+/" –  Thorsten Kranz Feb 5 '13 at 8:02
@ThorstenKranz sorry, didn't catch the last part, thanks! –  Volatility Feb 5 '13 at 8:13
Sure, no problem. And forgetting something might also be the problem with the other answer, thus I prefer the string-approach –  Thorsten Kranz Feb 5 '13 at 8:28

Strings are sequences too.

share|improve this answer
Thank you - that's getting smaller. :D –  sdasdadas Feb 5 '13 at 7:11

Your Answer


