def abc(filename):
infile = open(filename, 'r+')
read = infile.read()
lst = read.split()
for i in lst:
if len(i) == 4:
i.replace(i, 'abcd')
print(i)
abc('question 4.txt')
I want to replace 4 character strings in my text file but apparently this is not happening. Everything seems to be working fine but the replacing function is not responding.