Chris Hengge wrote: > Still no progress with this myself. > > For clarification if I didn't provide enough earlier, > for item in list1: > if item in list2: > print item and list[object at location where matched item] <-- > need this location.
I still don't understand your question. If you want the index in list2 of the item that matches, use list2.find(item). If you want to enumerate over a list and have the list indices available as well as the list values, use enumerate() e.g. for i, item in enumerate(list1): # i is the index of item in list1 Kent > > On 10/18/06, *Chris Hengge* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> 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. > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor