From a25216b4ba5d7d8abaa48f53ad8dfd47b87660f9 Mon Sep 17 00:00:00 2001 From: David Avery Date: Thu, 13 Feb 2020 17:02:31 +0000 Subject: [PATCH] Lesson 77 --- basics.py | 10 ++++++---- files/fruits.txt | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/basics.py b/basics.py index 2ab166b..5ec9d6e 100644 --- a/basics.py +++ b/basics.py @@ -1,4 +1,6 @@ -with open("files/fruits.txt", "r") as myfile: - content = myfile.read(90) -with open("files/fruits-copy.txt", "w") as myfile: - myfile.write(content) \ No newline at end of file +with open("files/fruits.txt", "a+") as myfile: + myfile.write("\nOkra") + myfile.seek(0) + content = myfile.read() + +print(content) diff --git a/files/fruits.txt b/files/fruits.txt index 9e55d1b..a269cee 100644 --- a/files/fruits.txt +++ b/files/fruits.txt @@ -3,4 +3,5 @@ apple orange mandarin watermelon -pomegranate \ No newline at end of file +pomegranate +Okra \ No newline at end of file