=============== python 类型转换 =============== * int to binary .. code-block:: python >>> bin(6) '0b110' >>> bin(6)[2:] '110' * binary to int .. code-block:: python >>> int('11111111', 2) 255 >>> from bitstring import BitArray >>> b = Bitarray(bin='11111111') >>> b.uint 255 >>> b.int -1