[Tutor] Removing lines in string-table
Olli Rajala
olli.rajala at gmail.com
Tue May 17 09:52:39 CEST 2005
Okay,
I have a string table (don't recall the right word used in Python
right now) 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.
Back to coding...
--
Olli Rajala <><
Tampere, Finland
http://www.students.tut.fi/~rajala37/
"In theory, Theory and Practice should be
the same. But in practice, they aren't."
- Murphy's Proverbs
More information about the Tutor
mailing list