Dealing with files...

lost lost at soul.net
Sat Apr 26 10:19:35 EDT 2003


On Fri, 25 Apr 2003 22:13:35 -0400, George Kinney wrote:
> from glob import glob
> file_list = glob.glob(SomePath)
> outfile = open(OutputFilename, 'w')
> 
> for file in file_list :
>     print file
>     outfile.write(file + '\n')

thanks for the info, however that doesn't seem to work either? here's the
whole program that I'm trying:
#!/usr/bin/python
from glob import glob
file_list = glob.glob('/var/www/html/') for each_file in file_list:
        print each_file
print "done"

Running that gives me:
Traceback (most recent call last):
  File "files.py", line 6, in ?
    file_list = glob.glob('/var/www/html/')
AttributeError: 'function' object has no attribute 'glob'

Any ideas where I'm going wrong?
Thanks again...




More information about the Python-list mailing list