0

i wan to print the variable "ln" in the same line (overwriting the old output) but it doesn't seem to work before an if statement i tried this solution solution1 but it didn't workout

i have the following code :

if smtn == "othr":

  #lines variable reads a file line by line
  for ln in lines:

    #i tried this solution
    print("Line Is : " + ln , end="\r", flush=True)

    if var0 == "valu0":
      #do something
    elif var1 == "valu1":
      #do something
    elif var2 == "valu2":
      #do something
jst_a_usr
  • 1
  • 1
  • 1
    This doesn't work in every console. Some, you can use the backspace key to erase old output, some don't support that. Some support using a return like you have here, some don't. Try it in a different console. – Carcigenicate Apr 08 '20 at 00:06
  • @Carcigenicate , i managed to get it working but now small words don't overwrite the big ones properly you still can see the end of the big word added to the small word example : word1 : comment ,word2 : test ,output : testent – jst_a_usr Apr 08 '20 at 00:15

0 Answers0