问题
I am working on a script to show in the terminal an empty matrix with dot representing all the elements to be filled. Then, I want to ask to the user which element he wants to select for each position.
I had some issues that I couldn't solve with the code given by the professor:
Printing string elements on terminal at certain position.
I have found another way by writting the following code:
for y in range(0, nbLines):
for x in range(0, nbColumns):
print("{0}\t".replace('\t', ' ' * 5).format('.'), end='')
if x == nbColumns -1:
print('')
print("\n")
Now, I would like to know if there is a possibility to "go back" to the initial position with my first dot to ask the user to select each coefficient to the matrix ?
When we use \n
in print we do a line break, is there any way to reverse it by other print in order to come back to the initial position? In the picture added I would like to come back to the white rectangle.
来源:https://stackoverflow.com/questions/63777617/giving-a-specific-position-to-cursor-in-terminal-up-line-after-previous-line-b