aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiogo464 <[email protected]>2025-06-11 14:16:28 +0100
committerdiogo464 <[email protected]>2025-06-11 14:16:28 +0100
commit059f767d00bbe7ca569d658b1cb14fcb17105bcd (patch)
tree4a105e9ec17e4e254434c1fa433b7eaa2c3fe558
parentfe24027d59224e012ed8b5f86525eac4afdf3272 (diff)
dont add last new line in matrix file
-rw-r--r--app.py6
1 files 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):
48 48
49 # Write matrix to file 49 # Write matrix to file
50 with open(matrix_file_path, "w") as f: 50 with open(matrix_file_path, "w") as f:
51 for row in matrix: 51 for idx, row in enumerate(matrix):
52 f.write(" ".join(map(str, row)) + "\n") 52 if idx > 0:
53 f.write("\n")
54 f.write(" ".join(map(str, row)))
53 55
54 except Exception as e: 56 except Exception as e:
55 print(f"Error generating matrix: {e}") 57 print(f"Error generating matrix: {e}")