[Tutor] Location of found item in list.
John Fouhy
john at fouhy.net
Thu Oct 19 03:05:06 CEST 2006
On 19/10/06, Chris Hengge <pyro9219 at gmail.com> 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 want to print out the result of a
> match..
>
> Here is sample output.
> Tested: Textname: DirectoryName:
> Match! a.exe a.exe
> Fail! A.exe a.exe
for filename in Textname:
try:
print '%s found in DirectoryName at position %d' % (filename,
DirectoryName.index(filename))
except ValueError:
print '%s not found in DirectoryName.' % filename
?
More information about the Tutor
mailing list