From df89ccada0136f74feb5cbf8b52fb2eac3b9f53b Mon Sep 17 00:00:00 2001 From: David Avery Date: Wed, 5 Feb 2020 14:19:26 +0000 Subject: [PATCH] Lesson 76 --- basics.py | 7 +++---- fruits.txt => files/fruits.txt | 0 files/vegetables.txt | 4 ++++ 3 files changed, 7 insertions(+), 4 deletions(-) rename fruits.txt => files/fruits.txt (100%) create mode 100644 files/vegetables.txt diff --git a/basics.py b/basics.py index e3db141..950f189 100644 --- a/basics.py +++ b/basics.py @@ -1,4 +1,3 @@ -with open("fruits.txt") as myfile: - content = myfile.read() - -print(content) \ No newline at end of file +with open("files/vegetables.txt", "w") as myfile: + myfile.write("Tomato\nCucumber\nOnion") + myfile.write("\nGarlic") \ No newline at end of file diff --git a/fruits.txt b/files/fruits.txt similarity index 100% rename from fruits.txt rename to files/fruits.txt diff --git a/files/vegetables.txt b/files/vegetables.txt new file mode 100644 index 0000000..f91a6ab --- /dev/null +++ b/files/vegetables.txt @@ -0,0 +1,4 @@ +Tomato +Cucumber +Onion +Garlic \ No newline at end of file