2006年08月01日 星期二 06:48
def bin(n) : assert type(n) == type(1) result = '' while n != 0 : result = str(n % 2) + result n = n / 2 return result On 7/31/06, Leo Jay <python.leojay at gmail.com> wrote: > > On 7/31/06, 张鹏飞 <zhangpf at ichaier.com> wrote: > > > > > > > > 我知道转16进制的函数为hex() > > 转8进制的函数为oct() > > > > > > 可是转2进制的函数一直没找到,哪位告诉我一下!! > > > 参见 > http://groups.google.com/group/pythonzh/browse_frm/thread/a6d2e7751ec25ec8/a34afe730675fed7?lnk=st&q;=&rnum;=1#a34afe730675fed7 > > > -- > Best Regards, > Leo Jay > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to > python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to > python-chinese-request at lists.python.cn > Detail Info: > http://python.cn/mailman/listinfo/python-chinese > >
Zeuux © 2025
京ICP备05028076号