[Python] Prevent Python from showing entered input

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

  1. Stack

    Stack Membro Participativo

    In Python when I change the value of a variable through raw_input in the terminal it would write a new line stating its new value. I wanted to know if there is a way to avoid that because straight after user's input there is a print function which uses the value received before. In the end the user will get both values: original and modified while for the purpose of my program he only has to see the modified.

    I use IDLE to write my scripts and then execute them in terminal.

    Update

    A simple example would be the following. The input is string "Hello" and the output should be "Me: Hello". There should be no "Hello" before the final result.

    a = raw_input()
    print ("Me: " + a)


    And the output should be just

    Me: Hello


    rather than

    Hello
    Me: Hello

    Continue reading...

Compartilhe esta Página