read list of dirnames and search for filenames

Rob Wolfe rw at smsnet.pl
Tue May 1 17:36:43 EDT 2007


Rob Wolfe <rw at smsnet.pl> writes:

> fscked <fsckedagain at gmail.com> writes:
>
>> I cannot seem to get this to work. I am hyst trying to read in a list
>> of paths and see if the directory or any sub has a filename pattern.
>> Here is the code:
>>
>> import os, sys
>> from path import path
>>
>> myfile = open("boxids.txt", "r")
>> for line in myfile.readlines():

And you don't need to use ``readlines`` at all.
This is enough:

 for line in myfile:

-- 
HTH,
Rob



More information about the Python-list mailing list