Generators can only yield ints?
bearophileHUGS at lycos.com
bearophileHUGS at lycos.com
Fri Aug 22 19:00:13 EDT 2008
defn noob:
> Any way to get around this?
Your code is wrong, this is one of the correct versions:
from itertools import izip
def letters():
lower = xrange(ord('a'), ord('z')+1)
upper = xrange(ord('A'), ord('Z')+1)
for lc, uc in izip(lower, upper):
yield chr(lc)
yield chr(uc)
print list(letters())
There are other ways to do the same thing.
Bye,
bearophile
More information about the Python-list
mailing list