[Python] Is there a way to customize error messages shown by PyInputPlus?

Discussão em 'Python' iniciado por Stack, Março 30, 2025.

  1. Stack

    Stack Membro Participativo

    I've recently learned about PyInputPlus and how to use it. It is really awesome, but I am wondering is there a way to customize error messages that PyInputPlus shows when user enters invalid values. For example, in the code below

    import pyinputplus as pyip
    response=pyip.inputInt('please, enter a number: ')


    if a user enters letter 's', PyInputPlus shows -


    's' is not an integer
    ​

    I would like to cutomize that message, to show it in a different (non-english) language. I tried to find the solution in the official documentation at PyInputPlus but found nothing except using inputCustom which I am not interested in.

    Continue reading...

Compartilhe esta Página