hi i have a list (after reading from a file), say data = [ 'a','b','c','d','a','b','e','d']
I wanted to insert a word after every 'a', and before every 'd'. so i use enumerate this list: for num,item in enumerate(data): if "a" in item: data.insert(num+1,"aword") if "d" in item: data.insert(num-1,"dword") #this fails but the above only inserts after 'a' but not before 'd'. What am i doing wrong? is there better way?thanks -- http://mail.python.org/mailman/listinfo/python-list