0
how to prevent newline while taking input ?
while True : x=input("calcii : ") print(eval(x)) I need output like this : Calcii : 2+2 = 4 # 2+2 is input given by user real code : 👇👇 https://code.sololearn.com/cDgTNkPG4AY2/?ref=app
6 Réponses
+ 2
Works for me in pydroid
https://code.sololearn.com/co21zvWV2ZF3/?ref=app
+ 2
Slick Thanks for your answer! 😊
what is mean '\033[F' ?
is it same as '\r' ?
from where I can learn codes like this ?
+ 1
Its a character that brings the cursor up to the beggining of the previous line.
i think '\r' is for carridge return. Think about a type writer when you get to the end of a line on a piece of paper. When you get to the end, you shove the carridge right back to the begginning of the line.
"\033[F" will not go to the beggining of the current line, but the beggining of the previous one thats right above it.
i found it by searching "print on previous line python"
+ 1
My bad, the character should be "\033[A" not "\033[F" was doing some testing.
"\033[A" works just fine
0
Slick your code works same without using '\033[F'
then what's the case here ? 🤔