From f23d88b6fd26ea8ee64f9a0ca32760502608b456 Mon Sep 17 00:00:00 2001 From: David Avery Date: Wed, 5 Feb 2020 14:22:58 +0000 Subject: [PATCH] Coding exercise 48 --- basics.py | 7 ++++--- files/fruits-copy.txt | 6 ++++++ 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 files/fruits-copy.txt diff --git a/basics.py b/basics.py index 950f189..2ab166b 100644 --- a/basics.py +++ b/basics.py @@ -1,3 +1,4 @@ -with open("files/vegetables.txt", "w") as myfile: - myfile.write("Tomato\nCucumber\nOnion") - myfile.write("\nGarlic") \ No newline at end of file +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 diff --git a/files/fruits-copy.txt b/files/fruits-copy.txt new file mode 100644 index 0000000..9e55d1b --- /dev/null +++ b/files/fruits-copy.txt @@ -0,0 +1,6 @@ +pear +apple +orange +mandarin +watermelon +pomegranate \ No newline at end of file