The Alphabet
Oct 20
2009
2009
Comments Off
Python
import re _char = re.compile(r'\w') ''.join([chr(i) for i in xrange(65,122) if _char.match(chr(i))]) # or just: import string string.ascii_letters string.ascii_lowercase string.ascii_uppercase
Ruby
(65..122).to_a.map{ |e| e.chr =~ /\w/ && e.chr }.compact.to_s
Perl
$chars .= chr() =~ /\w/ ? chr() : q{} for 65..122;
I don’t like the mess of Ruby, and Perl.