Python-Colorama-在特定位置打印

Python-Colorama-在特定位置打印,python,position,colorama,Python,Position,Colorama,我希望用户在特定位置选择矩阵系数。 我在终端中看到奇怪的左箭头,在我看来,终端无法“支持”它。 当我想用点来表示每个矩阵的元素时,我也遇到了同样的问题 我用Colorama模块解决了这个问题。 它适用于点的表示,但不适用于矩阵系数的选择。 我使用了相同的代码和相同的位置 我错过了什么? 我应该再次调用init()吗 先谢谢你 致意 马修 from colorama import deinit, init import os init() nbColumns = 5 while nbColu

我希望用户在特定位置选择矩阵系数。 我在终端中看到奇怪的左箭头,在我看来,终端无法“支持”它。 当我想用点来表示每个矩阵的元素时,我也遇到了同样的问题

我用Colorama模块解决了这个问题。 它适用于点的表示,但不适用于矩阵系数的选择。 我使用了相同的代码和相同的位置

我错过了什么? 我应该再次调用init()吗

先谢谢你

致意

马修

from colorama import deinit, init
import os

init()

nbColumns = 5
while nbColumns > 4 :
    nbColumns = int(input("Enter a number of matrix columns (maximum 4) = "))

nbLines = 6
while nbLines > 5 :
    nbLines = int(input("Enter a number of matrix lines (maximum 5) = "))

os.system('cls')

A = [[0] * nbLines for _ in range(nbColumns)]
B = [[0] * nbLines for _ in range(nbColumns)]
C = [[0] * nbLines for _ in range(nbColumns)]

# to give some space in between each matrix coefficient
L = 6
H = 2

# points to mention where the coefficient are in each matrix 
for x in range(0, nbColumns) :
    for y in range(0, nbLines) :
        print(f"\033[{y*H+1};{x*L+1}H.")
        print(f"\033[{y*H+1};{(x+nbColumns+1)*L}H.")
        print(f"\033[{y*H+1};{(x+2*nbColumns+2)*L}H.")

print(f"\033[{(nbLines*H)//2};{nbColumns*L}H+")

print(f"\033[{(nbLines*H)//2};{(nbColumns*2+1)*L}H=")

# selection of the matrix A coefficients
for x in range(0, nbColumns):
    for y in range(0, nbLines):
        A[x][y] = float(input(f"\033[{y*H+1};{x*L+1}H"))

# selection of the matrix B coefficients
for x in range(0, nbColumns):
    for y in range(0, nbLines):
        B[x][y] = float(input(f"\033[{y*H+1};{(x+nbColumns+1)*L}H"))

# calculation of the matrix C
for x in range(0, nbColumns):
    for y in range(0, nbLines):
        C[x][y] = A[x][y] + B[x][y]

# print of the matrix C
for x in range(0, nbColumns):
    for y in range(0, nbLines):
        print(f"\033[{y*H+1};{(x+2*(nbColumns+1)*L)}H{C[x][y]}")

deinit()

print("\n")