Re: [Tutor] os.walk() with multiple paths

2018-05-23 Thread Roel Schroeven
Pi schreef op 22/05/2018 21:06: import os files = [] def find_db(paths): for path in paths.split(): for root, dirs, filenames in os.walk(path): for name in filenames: if name.endswith((".db", ".sqlite", ".sqlite3")): files.append(

Re: [Tutor] os.walk() with multiple paths

2018-05-22 Thread Alan Gauld via Tutor
On 22/05/18 20:06, Pi wrote: > works fine, but only for one path. And I need to use more than one path. > With one path given works great: > > >>> find_db("/dbbs") > ['april.db, /dbbs/analysis/april.db', 'important.sqlite, > /dbbs/temp/important.sqlite', 'march.db, /dbbs/analysis/march.db',

[Tutor] os.walk() with multiple paths

2018-05-22 Thread Pi
Hello Tutor, I'm stuck and i really need help. Google and I can't find answer for my problem. I've wrote app searching through directories database files. It works fine, but only for one path. And I need to use more than one path. This is my code: import os files = [] def find_db(paths):

Re: [Tutor] os.walk()

2006-08-03 Thread Alan Gauld
"Christopher Spears" <[EMAIL PROTECTED]> wrote> for root,dirs,files in os.walk(base): > for name in files: > path = os.path.join(root, name) > print path > > Sample output: > > ./gui_screenshot.jpeg > ./find_items.pyc > ./find_items.py > ./os > ./LearningToProgram/loggablebankaccount.py > I'm gl

[Tutor] os.walk()

2006-08-02 Thread Christopher Spears
I'm creating a function that traverses a directory tree and prints out paths to files: #!/usr/bin/python import os, os.path, glob def traverse(base = '.'): for root,dirs,files in os.walk(base): for name in files: path = os.path.join(root, name)