0

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

3
Contributors
5
Replies
8
Views
5 Years
Discussion Span
Last Post by Lucy Four
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]

Edited by Malraux: n/a

0

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!

Edited by Malraux: n/a

0

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

Edited by pyTony: n/a

2

'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'

Edited by Lucy Four: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.