print a ... z, A ... Z, "\n"' in Python
aleax at mac.com
Sat Mar 3 17:23:53 CET 2007
js <ebgssth at gmail.com> 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:
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