On May 17, 11:04 pm, Stargaming <[EMAIL PROTECTED]> wrote: [...] > >>>Is there an *easy* way to convert a number to binary? [...] > > Wrote this a few moons ago:: > > dec2bin = lambda x: (dec2bin(x/2) + str(x%2)) if x else ''
This is awesome. Exactly what I was looking for. Works for other bases too. I guess the reason I couldn't come up with something like this was being brainwashed that lambda is a no-no. And python2.5 funky ?: expression comes in handy! Thanks a lot! -- http://mail.python.org/mailman/listinfo/python-list