Lyosha <[EMAIL PROTECTED]> wrote: > 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.
Just don't pass it a negative number ;-) -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list