import os def search(drive,name): for dirpath, dirs, files in os.walk(drive): if name in files: return (os.path.join(dirpath, name))