1

I am struggling to save some hexadecimal format alphanumerical codes into string.

Let's say

a = 0xbe2c

how to convert it into

 "0xbe2c"

I have a list of such codes. If anyone knows the solution, please help.

Thank you in advance!

1
  • Please update your question with the code you have tried. Commented Jun 12, 2021 at 10:57

2 Answers 2

3

hex(x) returns a number in hexadecimal notation:

>> a = 0xbe2c
>> a
48684
>> hex(a)
'0xbe2c'
Sign up to request clarification or add additional context in comments.

Comments

3

You could do a variety of things -

>>> a = 0xbe2c
>>> hex(a)
'0xbe2c'
>>> str(a)
'48684'
>>> int(a)
48684

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.