def to_matlab(): beginning = "■(" while True: str_mat = input("Enter a matrix (or matrice) in word format:\n") if(str_mat == "help"): print("Copy a matrix from work and paste it here") continue print(str_mat.replace(beginning, "").replace("&", " ") .replace("@", ";").replace("][", "]*[") .replace(")]*", "]*").replace(")]", "]")) if __name__ == "__main__": to_matlab()