I am new in python and I have the following problem: Suppose I have a list with words of which I want to remove each time the words in the lines below item1 and above item2:
item1 a b item2 c d item3 e f item4 g h item1 i j item2 k l item3 m n item4 o p I did not find out how to do this: Part of my script was f = re.compile("item\[1\]\:") g = re.compile("item\[2\]\:") for i, line in enumerate(list1): f_match = f.search(line) g_match = g.search(line) if f_match: if g_match: if list1[i] > f_match: if list1[i] < g_match: del list1[i] But this does not work If someone can help me, thanks! -- http://mail.python.org/mailman/listinfo/python-list