Just Another Question on this one, Im trying to create that kind of thing in code now:<br><br>#GENERE ET INCREMENT LE NOM DES ELEMENTS
<p style="margin: 0px; text-indent: 0px;">val = 0</p>
<p style="margin: 0px; text-indent: 0px;">list = ["0", "1", "2", "3"]</p>
<p style="margin: 0px; text-indent: 0px;">listEl = []</p>
<p style="margin: 0px; text-indent: 0px;">for n in list:</p>
<p style="margin: 0px; text-indent: 0px;">        val = val +  1</p>
<p style="margin: 0px; text-indent: 0px;">        next = "00" +str(val) </p>
<p style="margin: 0px; text-indent: 0px;">        elem = "ELM"+next</p>
<p style="margin: 0px; text-indent: 0px;">        listEl.append(elem) <br></p><p style="margin: 0px; text-indent: 0px;"><br></p><p style="margin: 0px; text-indent: 0px;"><br></p>


<p style="margin: 0px; text-indent: 0px;">#INCREMENT LE NOM DES ELEMENTS AVEC LE NOM DES PASSES</p>
<p style="margin: 0px; text-indent: 0px;">listPass = ["DIF","SPC", "RFL", "SSS", "REFR", "ALB", "AMB", "NRM", "MVE", "DPF", "SDW", "MAT", "WPP"]</p>

<p style="margin: 0px; text-indent: 0px;">listElem = []</p>
<p style="margin: 0px; text-indent: 0px;">for first in listEl:</p>
<p style="margin: 0px; text-indent: 0px;">        for second in listPass:</p>
<p style="margin: 0px; text-indent: 0px;">                listElem.append(first+"_"+second)</p><p style="margin: 0px; text-indent: 0px;"><br></p>

<p style="margin: 0px; text-indent: 0px;">print listElem</p>
<p style="margin: 0px; text-indent: 0px;">print listEl</p><br>What I would like to do is:<br><br>if 'ELM001' Contained in one of the entries of listElem, create a new list with only 'ELM001' Elements (eg: newList=['ELM001_DIF', 'ELM001_SPC', 'ELM001_RFL', 'ELM001_SSS', 'ELM001_REFR', 'ELM001_ALB', 'ELM001_AMB', 'ELM001_NRM', 'ELM001_MVE', 'ELM001_DPF', 'ELM001_SDW', 'ELM001_MAT', 'ELM001_WPP']<br>
<br>Damn Im sooooooooo lost with this tables and loop, Im always trying to understand in which way I should do it.... :/<br>Any Ideas please ?<br><br><br><div class="gmail_quote">2010/8/31 Alban Nona <span dir="ltr"><<a href="mailto:python.koda@gmail.com">python.koda@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">Well, I have a lot to learn :)<br><br>Thank you very much both of you ! 
it seems to work now :p<br><br></div><div class="gmail_quote"><div class="im">2010/8/31 MRAB <span dir="ltr"><<a href="mailto:python@mrabarnett.plus.com" target="_blank">python@mrabarnett.plus.com</a>></span><br></div>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>On 31/08/2010 20:20, Alban Nona wrote:<div><div></div><div class="h5"><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Ok, here a solution:<br>
<br>
myFirstList = ["FN067_098_MEN", "FN067_098_JIN", "FN067_098_BG"]<br>
<br>
mySecondList =<br>
["FN067_098_MEN_Hair_PUZ_v001.0001.exr","FN067_098_JIN_Hair_SPC_v001.0001.exr","FN067_098_MEN_Jin_MVE_v001.0001.exr","FR043_010_GEN_NRM_v001.0001.exr"]<br>
<br>
for n in myFirstList:<br>
      var = str(n)<br>
</blockquote>
<br></div></div></div><div><div></div><div class="h5">
Why str(n)?<br>
<br>
Also, it would be clearer if you used different variables for the<br>
different loops.<div><br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
      for n in mySecondList:<br>
          if var in n:<br>
               mySecondList.remove(n)<br>
</blockquote>
<br></div>
You shouldn't change the length of a list over which you're iterating. Python will step along the list one entry at a time and won't notice when you remove an entry, so the next one will be skipped. For example:<br>


<br>
>>> letters = ["a", "b", "c", "d", "e"]<br>
>>> for i in letters:<br>
...     if i == "b" or i == "c":<br>
...         letters.remove(i)<br>
...<br>
>>> print letters<br>
['a', 'c', 'd', 'e']<br>
<br>
It removed "b" and then moved on to the next entry, which is "d"<br>
because "b" has been removed and all the following entries have moved<br>
down one place. It never sees "c".<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
print mySecondList<br>
<br>
</blockquote>
[snip]<div><div></div><div><br>
-- <br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</div></div></div></div></blockquote></div><br>
</blockquote></div><br>