I need to convert either base 10 or base 16(hex) to base 2(binary) and back again.

What is the easist way to do this?

Would converting from/to base 8(oct) to binary be easier?
I need to convert either base 10 or base 16(hex) to base 2(binary) and back again.
What is the easist way to do this?
Would converting from/to base 8(oct) to binary be easier?
You can find one recipe describing how to do this at http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440528 .
I searched with Google, and I think this is the simpliest example: http://myphotoblogbeta.blogspot.com/2007/07/pythonconverttoandfrombaseb.html
(But I did not tried it, so verify first it is doing the counting right!)
Thanks. That helped.
BeBrawâ€™s suggestion was the best for what I needed.