Yes, I tried what you suggested, I've changed my looping structure to this:<br><br> count = 0<br> for itemLine in lineList:<br> for itemDirectory in directoryList:<br> if itemLine == itemDirectory:<br>
print match.ljust(20) + itemLine.ljust(20) + itemDirectory.ljust(20)<br> else:<br> print fail.ljust(20) + itemLine.ljust(20) + itemDirectory.ljust(20)<br> #os.rename(pathName + item, pathName + LineList[count])
<br> count = count + 1<br><br>I'm just trying to figure out where to put the break(s), but I need to verify this is working since I'll be using it to rename files.. my old structure did EXACTLY what I wanted (I replied to my original post with more details and screen captures) as far as renaming the files.. but the display was screwed up.
<br><br><div><span class="gmail_quote">On 10/18/06, <b class="gmail_sendername">Luke Paireepinart</b> <<a href="mailto:rabidpoobear@gmail.com">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>> Ok the example I gave here wasn't written as I had it in my head.. you<br>> are right, the example only had 1 sentence.<br>><br>> Inputs:<br>> List1 ['a.exe','b.exe',c.exe']<br>> List2 ['
A.exe',B.eXe',c.EXE']<br>><br>> for item in List1:<br>> if item in List2:<br>> print item + " " + list2thing that matched.<br>><br>> I can't force to upper or lower, that would break the already working
<br>> code..<br>><br>> Its just this darn output for list2 that isn't working.<br>><br>> I tried the suggested list.index(item) but that wont work if there<br>> isn't a match.<br>Well, yeah, but it won't go into the if statement if there isn't a
<br>match so what does that matter?<br>> Right now my code works when there is a match, and if there isnt'...<br>> It also works for renaming the actual file to match the file call from<br>> the document.<br>>
<br>> I'm about to take the display out, since I dont honestly care that it<br>> works, but now that I've been working with it I'm being stubborn and<br>> want the darn thing to show me =P<br>Did you try my example yet?
<br>It should work just fine.<br>just iterate over both of the lists...<br>for item1 in List1:<br> for item2 in List2:<br> if item1 == item2: #this is equivalent to 'if item1 in List2'<br>except will match ALL occurrences of item1 in List2. if you want to
<br>only match the first, add a break.<br> print item1+ ' ' + item2<br></blockquote></div><br>