I'm making a script that show you a question, you give the answer ("y" or "n") and the line is restarted, and appears another question. I've tried this (assuming that the number is the question)
import sys
for i in range (10):
sys.stdout.write('\r'+str(i))
label = input()
if label=='n':
doSomething
if label=='y':
doSomethingElse
but in this cases, I get this
0n
1n
2y
3n
and I want that if I have
0
I give my answer and press Enter, the currently line disappear and the new number appears
1
and then I give an answer again, and so on.
I've already check this question and this. I'm using python 3.5.
Edit: Thanks to an answer, now I know that I need to avoid the '\n' of the input() function.