That was supposed to say "Thanks for this" but I was in a hurry.<br><br>Anyways, here is my solution:<br># Remove any copies of .hex that aren't BMC<br> for foundItem in directoryList:<br> try:<br>
if ".hex" in foundItem.lower():<br> if "bmc" in foundItem.lower():<br> wantedList.append(foundItem)<br> else:
<br> print foundItem + " removed!"<br> else:<br> wantedList.append(foundItem)<br> except:<br> print "Failed to strip excess hex files."
<br><br><div><span class="gmail_quote">On 10/27/06, <b class="gmail_sendername">Chris Hengge</b> <<a href="mailto:pyro9219@gmail.com">pyro9219@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Thats for this very humorous reply =D<div><span class="e" id="q_10e8b2bc12c19acc_1"><br><br><div><span class="gmail_quote">On 10/26/06, <b class="gmail_sendername">Luke Paireepinart</b> <<a href="mailto:rabidpoobear@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
rabidpoobear@gmail.com</a>> wrote:</span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Chris Hengge wrote:<br>> Here is my code:<br>> for unWantedItem in directoryList:<br>
> try:
<br>> if "hex" in unWantedItem.lower():<br>> if not "bmc" in unWantedItem.lower():<br>> print unWantedItem + " removed!"<br>
> directoryList.remove(unWantedItem)<br>><br>> This only seems to loop through once, and removes 1 of 2 occurances<br>> from this list that should be captured. Should "for" keep the list
<br>> going through each instance?<br>><br>You're removing stuff from something you're iterating over!<br>*slaps your fingers with a ruler*<br>Make a copy of the list!<br>HTH,<br>-Luke<br><br></blockquote></div><br>
</span></div></blockquote></div><br>