Please code review.
rosuav at gmail.com
Tue Aug 2 14:07:28 CEST 2011
On Tue, Aug 2, 2011 at 12:45 PM, Karim <kliateni at gmail.com> wrote:
> ... for char in cellnames.replace('', ' ').split()[:cols]:
for char in cellnames[:cols]:
Strings are iterable over their characters. Alternatively, you could
use chr and ord, but it's probably cleaner and simpler to have the
string there. It also automatically and implicitly caps your columns
at 26. On the other hand, if you want to support more than 26 columns,
you may want to make your own generator function to yield 'A', 'B',...
'Z', 'AA', 'AB', etc.
More information about the Python-list