[Tutor] Location of found item in list.

Chris Hengge pyro9219 at gmail.com
Thu Oct 19 03:52:17 CEST 2006

Well, if you refer to my thread where I mentioned that I had a screen
capture of the output.. I want it to look like that..

now it yells at me for everything that doens't match and does match. =D

I dont think this test is working though, because using your suggested

Fail!               SL_39.sdr           flashupdt.cfg
Fail!               SL_39.sdr           flashupdt_da.cfg
Fail!               SL_39.sdr           MASTER.CFG
Fail!               SL_39.sdr           MASTER_da.CFG
Fail!               SL_39.sdr           PSL_MBD5.FRU
Fail!               SL_39.sdr           P_R24BP.FRU
Fail!               SL_39.sdr           P_R24BPE.FRU
Fail!               SL_39.sdr           P_R26BP.FRU
Fail!               SL_39.sdr           P_R26BPE.FRU
Fail!               SL_39.sdr           R0066.Cap
Fail!               SL_39.sdr           R24BP202.hex
Fail!               SL_39.sdr           R26BP202.hex
Fail!               SL_39.sdr           RA_MBD4.FRU
Fail!               SL_39.sdr           SLBMC55.hex
Fail!               SL_39.sdr           SL_39.SDR
Fail!               SL_39.sdr           S_R24BP.FRU
Fail!               SL_39.sdr           S_R24BPE.FRU
Fail!               SL_39.sdr           S_R26BP.FRU
Fail!               SL_39.sdr           S_R26BPE.FRU
Fail!               SL_39.sdr           XSL_MBD3.FRU
Fail!               SL_39.sdr           XVN_MBD3.FRU

Ok, I dont want it to rename SL_39.sdr for each of those fails... just the
one where I bolded.. this worked with my loop method, but the 3rd columns
output wasn't correct.

Loop = works
Display = wrong

On 10/18/06, Luke Paireepinart <rabidpoobear at gmail.com> wrote:
> Chris Hengge wrote:
> > Yes, I tried what you suggested, I've changed my looping structure to
> > this:
> >
> >     count = 0
> >     for itemLine in lineList:
> >         for itemDirectory in directoryList:
> >             if itemLine == itemDirectory:
> >                 print match.ljust(20) + itemLine.ljust(20) +
> > itemDirectory.ljust(20)
> >             else:
> >                 print fail.ljust(20) + itemLine.ljust(20) +
> > itemDirectory.ljust(20)
> >             #os.rename(pathName + item, pathName + LineList[count])
> >         count = count + 1
> >
> > 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.
> under what conditions do you want to break?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20061018/54d3fac7/attachment.htm 

More information about the Tutor mailing list