Hi All, playing around with the tut now. How can I get this code to remove the original instance of 'roof'.? >>> hotcat = ['Cat', 'roof', 'on', 'a', 'hot', 'tin'] >>> for x in hotcat[:]: ... if x == 'roof': hotcat.insert(6,x) ... >>> hotcat ['Cat', 'roof', 'on', 'a', 'hot', 'tin', 'roof']
Perhaps a replace or something after the 2nd line of the for function.? >>> hotcat = ['Cat', 'roof', 'on', 'a', 'hot', 'tin'] >>> for x in hotcat[:]: ... if x == 'roof': hotcat.insert(6,x) ... hotcat[x:len(x)] = [] ... Traceback (most recent call last): File "<stdin>", line 3, in ? TypeError: slice indices must be integers I feel I'm close to it. Cheers. Mark Sargent. -- http://mail.python.org/mailman/listinfo/python-list