May-24-2017, 05:04 PM
If a line in my program contains the word murder, how can I get my program to replace the word murder with "-------")?
import sys file = input('Enter the file name: ') print() try: fhand = open(file) except: print('File cannot be opened:', file) sys.exit() for line in fhand: if line == '\n': continue line = line.strip() print(line.upper())