How to convert hex string to hex number?

前端 未结 8 1225
孤独总比滥情好
孤独总比滥情好 2020-12-09 17:36

I have integer number in ex. 16 and i am trying to convert this number to a hex number. I tried to achieve this by using hex function but whenever you provide a integer numb

8条回答
  •  旧时难觅i
    2020-12-09 18:08

    With Python 2.6.5 on MS Windows Vista, the command line interpreter behaves this way:

    >>>hex(16)
    '0x10'
    >>>print hex(16)
    0x10
    

    I guess this is the normal behavior:

    >>>'abc'
    'abc'
    >>>print 'abc'
    abc
    

    I hope it helps

提交回复
热议问题