I am trying to convert big integer number to hexadecimal, but in result I get extra \"0x\" in the beginning and \"L\" at the and. Is there any way to remove them. Thanks. The nu
Be careful when using the accepted answer as lstrip('0x')
will also remove any leading zeros, which may not be what you want, see below:
>>> account = '0x000067'
>>> account.lstrip('0x')
'67'
>>>
If you are sure that the '0x'
prefix will always be there, it can be removed simply as follows:
>>> hex(42)
'0x2a'
>>> hex(42)[2:]
'2a'
>>>
[2:]
will get every character in the string except for the first two.