Answers for "os.walk() python"

3

os walk example

import os
folder_path = r'C:Test'
for root,dirs,files in os.walk(folder_path, topdown=True):
  print(root)
  print(dirs)
  print(files)
Posted by: Guest on June-25-2020
1

os.walk python

# !/usr/bin/python

import os
for root, dirs, files in os.walk(".", topdown=False):
   for name in files:
      print(os.path.join(root, name))
   for name in dirs:
      print(os.path.join(root, name))
Posted by: Guest on May-10-2021

Code answers related to "os.walk() python"

Python Answers by Framework

Browse Popular Code Answers by Language