View Single Post
Old Jan 12th, 2006, 4:20 PM   #5
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Quote:
Originally Posted by Sane
Hey, it would be good to use os.walk if you don't know what folder the file is located in.
Oho! I didn't know about that particular function. So my previous search function could be very neatly reduced to a mere four lines:
def file_search(search_file, path):
    for path, dirs, files in os.walk(path):
        if search_file in files:
            return os.path.join(path, search_file)
Arevos is offline   Reply With Quote