I'm debugging a python script in PyCharm and can't find a way to display integer values as hexadecimal numbers. Is it at all possible in this IDE?
To assign value in hexadecimal format to a variable, we use 0x or 0X suffix. It tells to the compiler that the value (suffixed with 0x or 0X) is a hexadecimal value and assigns it to the variable.
PyCharm allows you to inspect variables in a dedicated dialog. This is useful when you need to keep track of some variable (or the object whose reference it holds) and at the same time be able to navigate between frames and threads. Right-click a variable on the Variables tab and select Inspect.
The only reliable way to know what type a given object is is to inspect it at runtime - which is usually done using a step debugger (either python's builtin pdb or PyCharm's own debugger). Note that you'll have to check the various code path that can lead to the portion of the code you want to inspect though.
Variables Last modified: 27 July 2022. The Variables pane enables you to examine the values stored in the objects of your application.
This feature (for PyCharm) is implemented and is going to be included in 2019.3 release. Ticket https://youtrack.jetbrains.com/issue/PY-8118
Update 2019.3.4
As @ndclt pointed out, you can't yet, but a workaround for the time being could be using the evaluate expression
functionality.
Say you are interested in the hex representation of a
, you can use the built-in function hex() to achieve this:
hex(a)
Putting this in the evaluate expression dialog would give you the hex representation string.
You can bring up that action using CTRL+F8 (Windows/Linux) or ALT+F8 (Mac).
Yet, you can't. There is an open issue also concerning Pycharm if you want to follow this feature.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With