hex() argument cannot be converted to hex

hex, python

Solution

pin = hex(int("2FFF6996".replace('L', '').upper()[2:].zfill(8), 16))

>>> pin
'0xff6996'

you can remove `upper` and `hex` if you want a number from string to pass it to `print` function like a `%X` parameter:

>>> pin = int("2FFF6996".replace('L', '')[2:].zfill(8), 16)
>>> pin
16738710
>>> print "0x%X" % pin
0xFF6996

Problem

I am trying to do the following; ``` pin = hex("2FFF6996").replace('L', '').upper()[2:].zfill(8) ``` However I am getting an error - hex() argument cannot be converted to hex. Any help would be appreciated!

Original source