[Tutor] Escaping globs for glob.iglob()

Alan Gauld alan.gauld at btinternet.com
Tue Aug 21 09:59:32 CEST 2012


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.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list