[Python] Print only assert message in Python

Discussão em 'Python' iniciado por Stack, Julho 16, 2025.

  1. Stack

    Stack Membro Participativo

    Is there any way print only assert message:

    assert 5==4, "test"

    will print:

    Traceback (most recent call last):
    File "C:\Users\user\temp\test.py", line 4, in <module>
    assert 5==4, "test"
    AssertionError
    [Finished in 221ms]


    How to set it up, so it will print only:

    "test"

    Continue reading...

Compartilhe esta Página