From 4cde96ac81fdd55cc301442c9202b24c52347f32 Mon Sep 17 00:00:00 2001 From: Luis Gallegos <66088319+luisito362@users.noreply.github.com> Date: Sat, 6 Apr 2024 09:49:25 +0800 Subject: [PATCH] Update wk7 - assignment 7.1.py --- wk7 - assignment 7.1.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/wk7 - assignment 7.1.py b/wk7 - assignment 7.1.py index 41b2acb..87b340a 100644 --- a/wk7 - assignment 7.1.py +++ b/wk7 - assignment 7.1.py @@ -2,11 +2,8 @@ You can download the sample data at http://www.pythonlearn.com/code/words.txt # Use words.txt as the file name -fname = raw_input("Enter file name: ") +# Use words.txt as the file name +fname = input("Enter file data: ") fh = open(fname) - -for line in fh: - line = line.rstrip() -line = line.upper() -print(line) - +for line in fh.readlines(): + print (line.upper().strip())