How to convert hex string to hex number?

前端 未结 8 1208
孤独总比滥情好
孤独总比滥情好 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条回答
  •  情歌与酒
    2020-12-09 18:14

    Using the string formatters (new first, then old):

    >>> '{:x}'.format( 12345678 )
    'bc614e'
    
    >>> '%x' % ( 12345678 )
    'bc614e'
    

提交回复
热议问题