printing bit representation of numbers in python

后端 未结 5 829
终归单人心
终归单人心 2020-12-13 06:05

I want to print the bit representation of numbers onto console, so that I can see all operations that are being done on bits itself.

How can I possibly do it in pyth

5条回答
  •  甜味超标
    2020-12-13 06:29

    This kind of thing?

    >>> ord('a')
    97
    >>> hex(ord('a'))
    '0x61'
    >>> bin(ord('a'))
    '0b1100001'
    

提交回复
热议问题