[Python] How to use user input and create class from it? [closed]

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

  1. Stack

    Stack Membro Participativo

    I want to have a program that you input something, and it gives you an error with that input. I know that in order to create a custom error, I can do something like:

    class CustomError(TypeError):
    pass
    raise CustomError


    How do you do it using input?

    Here's what I tried:

    class input('Error name:')(TypeError):
    pass
    raise input('Error name:')


    This might need you to input it twice, but I expected it to work. It didn't.

    Continue reading...

Compartilhe esta Página