From fc46a36559100db8ca6bc89b378cad2ad38cd942 Mon Sep 17 00:00:00 2001 From: Pharaoh Date: Sun, 16 Dec 2018 13:40:28 -0200 Subject: [PATCH 1/3] Update python_write.py Update to Python 3. --- basic_examples/python_write.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/basic_examples/python_write.py b/basic_examples/python_write.py index e5d08de..759419f 100644 --- a/basic_examples/python_write.py +++ b/basic_examples/python_write.py @@ -2,7 +2,7 @@ from sys import argv #unpack script, filename = argv -fp = open(filename, "w") -print "Writing to file %r " % fp -fp.write("Hello World") -fp.close() +# A more clean and modern Python 3 to write to file. +with open(filename, "w") as f: + print("Writing to file".format(f)) # As python 3+ + f.write("Hello World") From afa9f31ea5cf803c5804f44a9b4377abdd27a427 Mon Sep 17 00:00:00 2001 From: Pharaoh Date: Sun, 16 Dec 2018 19:14:32 -0200 Subject: [PATCH 2/3] Update python_write.py --- basic_examples/python_write.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basic_examples/python_write.py b/basic_examples/python_write.py index 759419f..491488d 100644 --- a/basic_examples/python_write.py +++ b/basic_examples/python_write.py @@ -4,5 +4,5 @@ script, filename = argv # A more clean and modern Python 3 to write to file. with open(filename, "w") as f: - print("Writing to file".format(f)) # As python 3+ + print("Writing to file".format(filename)) # As python 3+ f.write("Hello World") From 808a6195d7ef644ec6fe189d20b2629aae9ad947 Mon Sep 17 00:00:00 2001 From: Pharaoh Date: Sun, 16 Dec 2018 19:14:52 -0200 Subject: [PATCH 3/3] Update python_write.py --- basic_examples/python_write.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basic_examples/python_write.py b/basic_examples/python_write.py index 491488d..68d3575 100644 --- a/basic_examples/python_write.py +++ b/basic_examples/python_write.py @@ -4,5 +4,5 @@ script, filename = argv # A more clean and modern Python 3 to write to file. with open(filename, "w") as f: - print("Writing to file".format(filename)) # As python 3+ + print("Writing to file: ".format(filename)) # As python 3+ f.write("Hello World")