I've changed the code a little bit and works fine now: inf = open('input.txt') out = open('output.txt', 'w')
skips = [ 'xxxxxxx xxxxxxxxxx xxxxx xxxxxxx', 'yyyyy yyyyyy yyy yyyyyy yyyyy yyy'] for line in inf: flag = 0 for skip in skips: if skip in line: flag = 1 continue if flag == 0: out.write(line) inf.close() out.close() -- http://mail.python.org/mailman/listinfo/python-list