0

In the Python command line, numbers are outputted in decimal format. Is there any way to get idle to output the value as hexadecimal instead? I know I can use the hex(n) function but that gets very tedious to do for every line I want to see the hex value of and it would be easier if I can just get python to output the numbers in hex format instead.

For example 22 and 7 here:

Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> 22
22
>>> a = 3
>>> b = 6
>>> a | b
7
>>>
Terry Jan Reedy
  • 18,414
  • 3
  • 40
  • 52
  • 4
    Does this answer your question? [Python console default hex display](https://stackoverflow.com/questions/6307433/python-console-default-hex-display). I suggest [rjb's answer](https://stackoverflow.com/a/43618365/4518341). – wjandrea Feb 05 '20 at 19:13
  • Yes thank you so much! I tried looking for that but couldn't come across it on google or the suggestions. – Winter Is Overflowing Feb 05 '20 at 19:18
  • I removed the IDLE tag because IDLE does not create your program's output. It merely displays the strings your program sends to sys.stdout, more or less the same as the Windows' console does when you run your code with python directly. – Terry Jan Reedy Feb 05 '20 at 22:50

0 Answers0