0

I was trying to over write a line I want to overwrite the pervious lines so it will appear like a different menu, but it doesn't seem to work with input function, how do I overwrite this?

def menu():

    sys.stdout.write("Menu 1")
    x = input("Enter: ")

    sys.stdout.write('\r other different data')
    sys.stdout.flush()


menu()
Jack
  • 1
  • Not sure if python supports ANSI escape codes, but take a look at http://stackoverflow.com/a/1348624/1709894 – HeroCC May 15 '17 at 00:13
  • 1
    input uses the standard in and waits for newline before returning data. This means that you are already on a new line – Menachem Hornbacher May 15 '17 at 00:13
  • **this is about what is displaying the output not your code.** IDLE, the default python ide does not support this and is not even simple to work around. If you run it with terminal/command line it should work. – Tadhg McDonald-Jensen May 15 '17 at 00:17
  • After `x = input("Enter: ")` is executed, the user enters their data, and presses `,` so - the script would be on a new line. – boardrider May 15 '17 at 09:14

0 Answers0