I have a txt file that I need to parse. I read the file in as a list, then strip the extra spaces. From there I need to remove one line. It contains "-----------------------" I am trying to get rid of it, but when I attempt to do the code below it doesn't seem to work correctly. When I print out the value of the line in the if statement it prints successfully, but won't delete that element from the list. If I remove it at the end, it works. What am I dont wrong?
   with open("somefile.txt") as f:
        output = f.readlines()
    
    for i,line in enumerate(output):
    
        if '-' in line:
            #print("this is the line " + str(line) )
            output.remove(line)
            #output.pop(i)
            continue
    
        output[i] = (" ".join(line.split()))
        output[i] = i.split(" ")[:2]
    
    
    #output.pop(1)
    #output.pop(2)
    
    print(output)
 
    