Python os.walk() loop directories for attribute -


i have text file containing directory names on each line (1, 2, 3), how can iterate through text file , have result inserted os.walk?

so far, have

import os os import listdir  dir_file = open("list.txt", "r")  root, dirs, files in os.walk(dir_file):     name in files:         print(os.path.join(root, name))     name in dirs:         print(os.path.join(root, name)) 

i have used combination of while loops , loops , if statements try , perform this, i've had no luck.

any help?

thanks

how about:

rdf = [] fff in dir_file:    r, d, f in os.walk(fff):       rdf.append(r, d, f) 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -