Convert from numbers to letters
Steven Bethard
steven.bethard at gmail.com
Thu May 19 16:43:30 EDT 2005
Jason Drew wrote:
> z = lambda cp: (int(cp[min([i for \
> i in xrange(0, len(cp)) if \
> cp[i].isdigit()]):])-1,
> sum(((ord(cp[0:min([i for i in \
> xrange(0, len(cp)) if \
> cp[i].isdigit()])][x])-ord('A')+1) \
> * (26 ** (len(cp[0:min([i for i in \
> xrange(0, len(cp)) if \
> cp[i].isdigit()])])-x-1)) for x in \
> xrange(0, len(cp[0:min([i for i in \
> xrange(0, len(cp)) if \
> cp[i].isdigit()])]))))-1)
While I think we can all agree that this is a sin against man and nature
;) I'll ignore that for the moment to note that you don't need any of
the '\' characters. You're already using parentheses and brackets. I
find there are *very* few cases where I really need a line-continuation
character.
STeVe
More information about the Python-list
mailing list