using this exact code:
count = 0
for item in lineList:
if item in directoryList:
print match.ljust(20) + item.ljust(20) + "this should be the object from directoryList"
else:
print fail.ljust(20) + item.ljust(20) + "this should be the object from directoryList"
#os.rename(pathName + item, pathName + item)
count = count + 1
my program works without ANY flaw.. it finds the name from the first list, compares it to the second list, and then renames the file in the directory if it doesn't match the one from the first list.
Here is output from the code above..
Tested: File Name: Directory Name:
Fail! SL_39.sdr this should be the object from directoryList
Match! PSL_MBD5.FRU this should be the object from directoryList
Match! XSL_MBD3.FRU this should be the object from directoryList
Match! RA_MBD4.FRU this should be the object from directoryList
Match! XVN_MBD3.FRU this should be the object from directoryList
Match! P_R24BP.FRU this should be the object from directoryList
Match! P_R26BP.FRU this should be the object from directoryList
Match! P_R24BPE.FRU this should be the object from directoryList
Match! P_R26BPE.FRU this should be the object from directoryList
Match! S_R24BP.FRU this should be the object from directoryList
Match! S_R26BP.FRU this should be the object from directoryList
Match! S_R24BPE.FRU this should be the object from directoryList
Match! S_R26BPE.FRU this should be the object from directoryList
I bolded the first line, just incase its lost in email land... the reason this line flagged fail! is because the filename for the real file located in the directory, is SL_39.SDR (I named it this so I could give an example).... now.. if I uncomment the os.rename() from my code (disabled while trying to figure out this problem), it will rename the file to the one located in the second column.. which is perfect.. what I want.. no questions asked.. I could remove the 'print' from this application, and it would do exactly what I want.. but I like the visual record for my own sanity..
What should be located in the 3rd column is the literal filename (which is located in directoryList). but, since I dont have a location to write directoryList[here] I can't print it out.
I've tried using directoryList[directoryList.index(item)], but that seems to be a case-sensitive check and fails to work.
On 10/18/06, Luke Paireepinart
<[EMAIL PROTECTED]> wrote:
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
> method.
>
>
[snip output]
>
> 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
The reason it worked with your method was because you were outputting
the same item.
Are you really just checking for same item but different case?
I have no idea what you're trying to do.
I don't think anyone else does either.
_______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
