I got a file having this kind of records:
I want to keep only the records that have 'MG' in position 34 and NOT ('RE' or 'RD') in position 41
What should I add to this code?
infile = 'DATA'
input = open(infile, 'r').readlines()
outfile = 'OUTPUT'
output = open(outfile, 'w')
for line in input:
linelist = line.split()
if ???? :