From df043d26fc978c337050334ce391f73878ae97be Mon Sep 17 00:00:00 2001 From: David Avery Date: Wed, 5 Feb 2020 14:15:10 +0000 Subject: [PATCH] Lesson 74 --- basics.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/basics.py b/basics.py index 9bcfb6a..e3db141 100644 --- a/basics.py +++ b/basics.py @@ -1,7 +1,4 @@ -def countstring(character, filepath): - myfile = open(filepath) +with open("fruits.txt") as myfile: content = myfile.read() - myfile.close() - return(content.count(character)) -print(countstring("a", "fruits.txt")) \ No newline at end of file +print(content) \ No newline at end of file