systematic use of context managers for dealing with files instead of open()/close...
[nepi.git] / examples / linux / ccn_simple_transfer.py
index 39ea8f0..ccf92eb 100644 (file)
@@ -147,9 +147,8 @@ ec.deploy()
 ec.wait_finished([ccncat])
 
 stdout = ec.trace(ccncat, "stdout")
-f = open("video.ts", "w")
-f.write(stdout)
-f.close()
+with open("video.ts", "w") as f:
+    f.write(stdout)
 
 ec.shutdown()