From 59816cfb6df0eee5f82742dd7ba1a3d9687f4fa2 Mon Sep 17 00:00:00 2001 From: Daniel Rojas Date: Fri, 22 May 2020 12:45:11 +0200 Subject: [PATCH] Optimize file output --- src/test.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test.py b/src/test.py index 26e3d4a..3427366 100644 --- a/src/test.py +++ b/src/test.py @@ -10,16 +10,16 @@ W1 = wireviz.Cable("W1", num_wires=3, color_code="DIN", shield=True) W1.connect(X1,(2,3,5),(1,2,3),X2,(1,3,2)) +objects = [X1, X2, W1] + with open('output/output.dot','w') as f: with open('input/header.dot','r') as infile: for line in infile: f.write(line) f.write('\n\n') - f.write(X1.graphviz() + '\n') - f.write(X2.graphviz() + '\n') - f.write(W1.graphviz() + '\n') - + for o in objects: + f.write(o.graphviz() + '\n') f.write('\n\n') with open('input/footer.dot','r') as infile: