[Python] Python sys.exit() hexidecimal value

Discussão em 'Python' iniciado por Stack, Abril 29, 2025.

  1. Stack

    Stack Membro Participativo

    I am looking to set an exit code of sys.exit(2)

    My issue is that, when I port this to a non-windows system, 2 actually translates to hexidecimal 200, which on this system is being returned as decimal 512

    I have tested this by setting sys.exit(3) and ending up with 768 (300 hex = 768 decimal)

    I have tried to strip the trailing 00 by using sys.exit(2).rstrip('0') but, that does not work.

    Is there a way for me to use sys.exit(2) and end up with hexidecimal 2 rather than hexidecimal 200?

    Continue reading...

Compartilhe esta Página