From 059f767d00bbe7ca569d658b1cb14fcb17105bcd Mon Sep 17 00:00:00 2001 From: diogo464 Date: Wed, 11 Jun 2025 14:16:28 +0100 Subject: dont add last new line in matrix file --- app.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index f8078c1..bbe6252 100644 --- a/app.py +++ b/app.py @@ -48,8 +48,10 @@ def generate_matrix_from_edges(edges_file_path, matrix_file_path): # Write matrix to file with open(matrix_file_path, "w") as f: - for row in matrix: - f.write(" ".join(map(str, row)) + "\n") + for idx, row in enumerate(matrix): + if idx > 0: + f.write("\n") + f.write(" ".join(map(str, row))) except Exception as e: print(f"Error generating matrix: {e}") -- cgit