Write a python script to ask users print all lines of a file.
Use try and except for bad inputs.
Use rstrip() to remove \n from end of each line to avoid unwanted gaps between lines.
Answers
Answered by
2
while True:
try:
fname = input("Enter a file name: ")
break
except:
print("Error")
continue
fhand =open(fname)
for line in fhand:
line = line.upper().rstrip()
print(line)
Please Mark Brainliest
Answered by
0
Thank you for free points
Similar questions
Computer Science,
3 months ago
Physics,
3 months ago
Physics,
8 months ago
Science,
8 months ago
Math,
1 year ago