Re: [Tutor] Location of found item in list.

2006-10-19 Thread Luke Paireepinart
Chris Hengge wrote: > This is the solution I came up with. > > for dirItem in directoryList: > directoryListLower.append(dirItem.lower()) > > #---Loop for file name comparison. > for item in lineList: # For every item in the 'lineList' > if item in directoryList: # If th

Re: [Tutor] Location of found item in list.

2006-10-19 Thread Chris Hengge
This is the solution I came up with.     for dirItem in directoryList:    directoryListLower.append(dirItem.lower())    #---Loop for file name comparison.    for item in lineList: # For every item in the 'lineList'     if item in directoryList: # If the item is also in 'directoryList'  

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Luke Paireepinart
Chris Hengge wrote: > 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 > properly.. > > I have list1 of filenames > I have list2 of filenames > > Item from list 1 needs to be found in

Re: [Tutor] Location of found item in list.

2006-10-18 Thread John Fouhy
On 19/10/06, Chris Hengge <[EMAIL PROTECTED]> wrote: > I think this is overkill for what I'm trying to do, could you please refer > to what I just wrote luke? That might make things simpler.. Did you try my code? It doesn't seem like overkill to me. Remember, there are no prizes for writing the

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Chris Hengge
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 properly.. I have list1 of filenamesI have list2 of filenames Item from list 1 needs to be found in list2, but I can't change cases, because

Re: [Tutor] Location of found item in list.

2006-10-18 Thread John Fouhy
Ok, so your question is: If nothing in directoryList matches item, how do I find the element of directoryList that should have matched? This is a bit tricky, because you need to define exactly what results you expect. (for example, suppose limitedLineList contained 'SL_39.sdr' and directoryL

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Chris Hengge
I think this is overkill for what I'm trying to do, could you please refer to what I just wrote luke? That might make things simpler.. On 10/18/06, John Fouhy <[EMAIL PROTECTED]> wrote:Ok, so your question is: If nothing in directoryList matches item, how do I find theelement of directoryList

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Chris Hengge
I've said in several of my emails that I understand that output is wrong... I just put it there until I had a fix... and so I could bold something to try and show people what I'm trying to do.. using this exact code:    count = 0    for item in lineList:    if item in directoryList:   

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Chris Hengge
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. =DI dont think this test is working though, because using your suggested method. Fail!   SL_39

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Luke Paireepinart
Chris Hengge wrote: > 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

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Luke Paireepinart
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(2

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Chris Hengge
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)    e

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Luke Paireepinart
Chris Hengge wrote: > I just replied to my original thread with output and real working code > and bolding and underlined items all over the place.. I dont see what > is so hard to explain... > > Please refer to that post, so I dont end up just copying and pasting. Please refer to my post so I ca

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Kent Johnson
Chris Hengge wrote: > Ok the example I gave here wasn't written as I had it in my head.. you > are right, the example only had 1 sentence. > > Inputs: > List1 ['a.exe','b.exe',c.exe'] > List2 ['A.exe',B.eXe',c.EXE'] > > for item in List1: > if item in List2: >print item + " " +

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Chris Hengge
I just replied to my original thread with output and real working code and bolding and underlined items all over the place.. I dont see what is so hard to explain... Please refer to that post, so I dont end up just copying and pasting. On 10/18/06, Kent Johnson <[EMAIL PROTECTED]> wrote: Chris Hen

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Chris Hengge
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.

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Luke Paireepinart
Chris Hengge wrote: > Ok the example I gave here wasn't written as I had it in my head.. you > are right, the example only had 1 sentence. > > Inputs: > List1 ['a.exe','b.exe',c.exe'] > List2 ['A.exe',B.eXe',c.EXE'] > > for item in List1: > if item in List2: >print item + " " + li

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Chris Hengge
Ok the example I gave here wasn't written as I had it in my head.. you are right, the example only had 1 sentence. Inputs:List1 ['a.exe','b.exe',c.exe']List2 ['A.exe',B.eXe',c.EXE']for item in List1: if item in List2:   print item + " " + list2thing that matched.I can't force to upper

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Chris Hengge
Why even try to use the 'in' syntax if it's not working correctly?Maybe I still don't understand. -LukeBecause I've been up for 40 hours... 5 days of the week I'm up at 8:45AM and I dont get home until 10PM, once I'm home, I do homework trying to finish my senior year, on the weekends I am either t

Re: [Tutor] Location of found item in list.

2006-10-18 Thread John Fouhy
On 19/10/06, Chris Hengge <[EMAIL PROTECTED]> wrote: > The point of this script is to read a text file that has a bunch of code > that calls external files. Then read the directory where all the files are.. > I build a list from the text file (this works correct), and I build a list > from the dire

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Luke Paireepinart
Chris Hengge wrote: > The point of this script is to read a text file that has a bunch of > code that calls external files. Then read the directory where all the > files are.. I build a list from the text file (this works correct), > and I build a list from the directory (this works correct). I

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Chris Hengge
The point of this script is to read a text file that has a bunch of code that calls external files. Then read the directory where all the files are.. I build a list from the text file (this works correct), and I build a list from the directory (this works correct). I want to print out the result of

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Kent Johnson
Chris Hengge wrote: > Tried your first suggestion. > AttributeError: 'list' object has no attribute 'find' Sorry, it's index() not find(). Strings have both but lists only have index() > > Perhaps a better explanation... > > > for word in paragraph: > if word in sentence: > prin

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Chris Hengge
Tried your first suggestion.AttributeError: 'list' object has no attribute 'find'Perhaps a better explanation... for word in paragraph: if word in sentence:  print word + sentence Assume that the word is only used once per paragraph. I can't figure out how to tell it to print the right

Re: [Tutor] Location of found item in list.

2006-10-18 Thread John Fouhy
On 19/10/06, Chris Hengge <[EMAIL PROTECTED]> wrote: > What that should have said > > For clarification if I didn't provide enough earlier, > for item in list1: > if item in list2: > print item and list2[object that matched item] <-- need this > location. Um, I'm still a bit confused.

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Kent Johnson
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.

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Chris Hengge
What that should have saidFor clarification if I didn't provide enough earlier, for item in list1:    if item in list2: print item and list2[object that matched item] <-- need this location. On 10/18/06, Chris Hengge <[EMAIL PROTECTED]> wrote: Still no progress with this myself. For clarifi

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Chris Hengge
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. On 10/18/06, Chris Hengge <[EMAIL PROTECTED]> wrote: I'm looking for a way to

[Tutor] Location of found item in list.

2006-10-18 Thread Chris Hengge
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) + directoryL