[Tutor] Escaping globs for glob.iglob()

Ray Jones crawlzone at gmail.com
Tue Aug 21 10:53:07 CEST 2012


On 08/21/2012 12:59 AM, Alan Gauld wrote:
> On 21/08/12 06:42, Ray Jones wrote:
>
>>    Files = glob.iglob(os.path.join(znDir, '*'))
>>    print Files
>>
>>    for moveFile in Files:
>>      print moveFile
>>
>> Nothing happens. The 'print...moveFile' never happens, even though print
>> Files shows it to be an iglob generator object.
>
> Good but does it contain anything?
> If not the loop will never execute.
> Did you try plain glob() which returns a list? Easier to see what the
> result set looks like.
>
Yes, I did try glob in the shell. It returned '[]' with the absolute
path or any relative path that included the directory with the '[1st]'
in it...which is what drew my focus to that portion of the path name to
begin with.

cheers.


Ray


More information about the Tutor mailing list