Answers for "list all files and folders in a directory python"

14

get list of folders in directory python

import os 
my_list = os.listdir('My_directory')
Posted by: Guest on June-08-2020
12

get files in directory python

import os
files_and_directories = os.listdir("path/to/directory")
Posted by: Guest on June-12-2020
7

list files in directory python

import os
print(os.listdir('/path/to/folder/to/list'))
Posted by: Guest on April-22-2020
0

python dir all files

import os

for root, dirs, files in os.walk("."):
    for filename in files:
        print(filename)
Posted by: Guest on February-12-2021

Code answers related to "list all files and folders in a directory python"

Python Answers by Framework

Browse Popular Code Answers by Language