Read and Write separately in python
<p>I'm trying to create a very simple program in python that needs to read input from the user and write output accordingly. I need an output similar to this:</p>

<pre><code>$./program.py
say something: Hello World
result: hello world
</code></pre>

<p>The thing is that i need to read input indefinitely, each time the user inputs data i would like that the printed data doesn't obstruct the input prompt. It will even better that no newlines be printed, keeping the output as above: a line for reading and another for writing.</p>

<p>I tried using curses but i don't want the hole screen to be used, just the two lines.</p>

<p>You can do veeeery simple trick:</p>

<pre><code>from os import system
while True:
    system('clear')  # or 'cls' if you are running windows
    user_input = input('say something:')
    print('result: ' + user_input)
    input()
</code></pre>

python terminal