python输出2进制数的方法:
在python中使用内置函数bin()将一个整数转换为二进制数输出即可。
bin() 返回一个整数 int 或者长整数long int的二进制表示。
示例:
>>> bin(3) '0b11' >>> bin(-10) '-0b1010'