quick, simple type conversion question #12816
-
I can convert an integer (eg 0x32) to a string ('0x32') easily
but I can't think of a way to do the reverse, ie change '0x32' into 0x32. Curious if someone knows how? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
There's a few ways but these are the first ways I thought of to convert both directions
|
Beta Was this translation helpful? Give feedback.
-
Or simply int('0x32') no need for the 0 or 16. The conversion is simple in either direction. |
Beta Was this translation helpful? Give feedback.
-
When I convert integer to string upython throws in a hex-to-decimal conversion for both types
but when I convert string to integer
I only get the hex-to-decimal conversion for one of the types. Does anyone know why that is? |
Beta Was this translation helpful? Give feedback.
There's a few ways but these are the first ways I thought of to convert both directions