0

I have a simple 2D grid and a function that prints it.

def printMaze(...):
    for i in range(0, rows):
        for j in range(0, cols):
            print(...)
        print('\n')

After I'm done printing my maze, I want to move my cursor back where it originally started, so that it can start printing my grid again, thus overwriting the previously printed maze and keep printing it "in-place". How can I achieve this in Python?

I tried print("\033[%d;%dH" % (0, 0)) but it doesn't work like I wanted to.

martineau
  • 112,593
  • 23
  • 157
  • 280

0 Answers0