print a ... z, A ... Z, "\n"' in Python

Alex Martelli aleax at
Sat Mar 3 17:23:53 CET 2007

js  <ebgssth at> wrote:

> HI guys,
> How do you write Perl's
>     print a ... z, A ... Z,  "\n"' in Python
> In Python?

This specific one is easy, though this doesn't generalize:

import string
print string.lowercase + string.uppercase

For the general case, there's no way to avoid calling chr and ord,
because a string in Python doesn't have a "natural successor". So the
only issue is how you prefer to hide those calls &c (in some class or
function) and you already received suggestions on that.


More information about the Python-list mailing list