Lyosha <[EMAIL PROTECTED]> writes: > On May 17, 4:40 pm, Michael Bentley <[EMAIL PROTECTED]> wrote: > > On May 17, 2007, at 6:33 PM, Lyosha wrote: > > > Is there an *easy* way to convert a number to binary? > > > > def to_base(number, base): > > [function definition] > > > > Hope this helps, > > Michael > > That's way too complicated... Is there any way to convert it to a > one- liner so that I can remember it?
You put in a module so you don't *have* to remember it. Then, you use it in this one-liner: foo = to_base(15, 2) Carrying a whole lot of one-liners around in your head is a waste of neurons. Neurons are far more valuable than disk space, screen lines, or CPU cycles. -- \ "Quidquid latine dictum sit, altum viditur." ("Whatever is | `\ said in Latin, sounds profound.") -- Anonymous | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list