[Tutor] Location of found item in list.
Chris Hengge
pyro9219 at gmail.com
Thu Oct 19 03:34:54 CEST 2006
For all who dont get what I'm trying to do... I've bolded what needs to
change...
This is the code...wanted result of the comparisons works, but I am unable
to display correctly..
count = 0
for item in limitedLineList:
if item in directoryList:
print match.ljust(20) + item.ljust(20) + item.ljust(20)
else:
print fail.ljust(20) + item.ljust(20) + item.ljust(20)
#os.rename(pathName + item, pathName + limitedLineList[count])
count = count + 1
This is a pretty capture of the real output this script provides... (its
formatted on the screen, but drops when I past here)
Tested: File Name: Directory Name:
Fail! SL_39.sdr SL_39.sdr
Match! PSL_MBD5.FRU PSL_MBD5.FRU
Match! XSL_MBD3.FRU XSL_MBD3.FRU
Match! RA_MBD4.FRU RA_MBD4.FRU
Match! XVN_MBD3.FRU XVN_MBD3.FRU
Match! P_R24BP.FRU P_R24BP.FRU
Match! P_R26BP.FRU P_R26BP.FRU
Match! P_R24BPE.FRU P_R24BPE.FRU
Match! P_R26BPE.FRU P_R26BPE.FRU
Match! S_R24BP.FRU S_R24BP.FRU
Match! S_R26BP.FRU S_R26BP.FRU
Match! S_R24BPE.FRU S_R24BPE.FRU
Match! S_R26BPE.FRU S_R26BPE.FRU
Ok, I bolded the line that is my example.
3rd column should say SL_39.SDR (because I just changed it to that so it
would flag as failed)
if you look at my code for both match and fail, I printed item... (just to
make the darn thing work for now) the 3rd column needs to be the value from
the 2nd list (directoryList) This list item is what I can't get to print.
If I uncomment the underlined line of my script, it will infact rename the
lowercase extension to uppercase, as it should.
On 10/18/06, Chris Hengge <pyro9219 at gmail.com> wrote:
>
> I'm looking for a way to do the following.
>
> for item in limitedLineList:
> if item in directoryList:
> print match.ljust(20) + limitedLineList[count].ljust(20) +
> directoryList[ count].ljust(20)
> else:
> print fail.ljust(20) + limitedLineList[count].ljust(20) +
> directoryList[count].ljust(20)
> os.rename(pathName + directoryList[ count], pathName +
> limitedLineList[count])
> count = count + 1
>
> Where I have underlined, needs to be the item from the directoryList, and
> I'm unable to find a way to return that.
>
> The code is actually doing what I want correctly, (cheated a test by hand
> changing variables), but I need to find the directory location.
>
> Thanks.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20061018/213829da/attachment.html
More information about the Tutor
mailing list