Dealing with files...

Steven Taschuk staschuk at telusplanet.net
Sat Apr 26 12:21:42 EDT 2003


Quoth George Kinney:
> "lost" <lost at soul.net> wrote in message
> news:pan.2003.04.26.14.19.35.262492 at soul.net...
  [...]
> > from glob import glob
> > file_list = glob.glob('/var/www/html/') for each_file in file_list:
  [...]
> > AttributeError: 'function' object has no attribute 'glob'
  [...]
> Sorry, I should have pointed out that glob does wild-card expansion (not
> just a dir list).

True, but not related to lost's problem above, as a careful
reading of the exception message will show.

Either of
    import glob
    file_list = glob.glob('whatever')
or
    from glob import glob
    file_list = glob('whatever')
will send the AttributeError packing.

-- 
Steven Taschuk                            staschuk at telusplanet.net
Every public frenzy produces legislation purporting to address it.
                                                  (Kinsley's Law)





More information about the Python-list mailing list