Hello

I have a sequence that looks like this:
60211401dc070000
which is a string (it was build through a series of concatenations and conversions)

How can i just tell him that it is actually a hex ?? without modifying it's value...

Thanks!
Have a nice day

int(it, 16)

I did, and here is the result:
6926839700091502592

update:
so i converted it back to Hex, and it looks good..just that I have A "L" at the end of the sequence
any idee on how to get rid of it

update:
nevermind, thanks anyway

update:
in case someone else has this problem:
it = int(it, 16)
it = hex(it)[2:-1]

I did, and here is the result:
6926839700091502592

update:
so i converted it back to Hex, and it looks good..just that I have A "L" at the end of the sequence
any idee on how to get rid of it

update:
nevermind, thanks anyway

update:
in case someone else has this problem:
it = int(it, 16)
it = hex(it)[2:-1]

Updated:

It is still treated as a string!!!
HELP!

Keep it number to use as number.
if you need to print it out use %x format in print statement.

'int('60211401dc070000', 16)' will be treated as a hexadecimal number, if you want to, say, add another hexadecimal number to it simple prelude it with a '0x'. For example:

>>> a = int('60211401dc070000', 16)
>>> a
6926839700091502592
>>> b = a + 0x000a            # Add the hex number 000a
>>> b
6926839700091502602
>>> hex(b)
'0x60211401dc07000a'
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.