[Tutor] Location of found item in list.

Chris Hengge pyro9219 at gmail.com
Thu Oct 19 04:28:52 CEST 2006

If that last post to Luke didn't clear anything up.. lets try this at a
smaller level...
I'm going to ignore the fact that my program already renames the file

I have list1 of filenames
I have list2 of filenames

Item from list 1 needs to be found in list2, but I can't change cases,
because thats what I'm looking for. I suppose, I could .sort each list after
chopping the extra files names out of list2 that aren't in list1. then all I
have to do is list1[count] = list2[count]

What I'd like to know, is why my program works, if I can't get it to display
the proper filename in the 3rd output column. I guess
iscasesensitive) ?

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/705608ed/attachment.html 

More information about the Tutor mailing list