fork download
  1. import os
  2.  
  3. def find_all(filename, rootdir):
  4. for dirpath, dirs, files in os.walk(rootdir):
  5. for file in files:
  6. if file == filename:
  7. yield os.path.join(dirpath, file)
  8.  
  9.  
  10. print(list(find_all('python', '/usr')))
Success #stdin #stdout 0.13s 10864KB
stdin
Standard input is empty
stdout
['/usr/bin/python']