Answers for "python os listdir directories only"

18

get list of folders in directory python

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

os.listdir in python

#import libs
import os

#set path of file or website on which listdir is to be applied
path='/users/desktop/dummy'

#Print all data in path

for file in os.listdir(path):
  print(file)
Posted by: Guest on June-06-2021

Python Answers by Framework

Browse Popular Code Answers by Language