newb question: file searching
jaysherby at gmail.com
jaysherby at gmail.com
Tue Aug 8 17:26:28 EDT 2006
So far, so good. I just have a few more questions.
Here's my code so far:
import os
top = '/home/USERNAME/'
images = []
for files in os.walk(top, topdown=True):
images += [file for file in files[2] if file.endswith('jpg')]
print images
I still need to know how I can dynamically get the name of the
directory that my script is in. Also, how can I get it to add the full
path of the file to "images" instead of just the file name. See, when
I go to use a particular image name later on, it won't do me much good
if I don't have the path to it.
More information about the Python-list
mailing list