On May 17, 2005, at 08:52, Olli Rajala wrote: > Okay, > I have a string table (don't recall the right word used in Python > right now)
It's called a list, or an array. > and would like to remove every 'cell' that contains a > string '_thumb.jpg'. There are 1-> digits before the string if that > matters. I made a for-loop that does what I want to: > > for line in fileNames: > if line[-10:] == '_thumb.jpg': > fileNames.remove(line) > > But I really doubt that it's not the best way to do this. So, any > comments are really appreciated. Looks like a job for a list comprehension: fileNames = [element for element in fileNames if not element.endswith ("_thumb.jpg")] -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting and sweating as you run through my corridors... How can you challenge a perfect, immortal machine?" _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor