Answers for "os.listdir current directory"

18

python list files in current directory

import os

files = os.listdir('.')
print(files)
for file in files:
  # do something
Posted by: Guest on November-04-2020
4

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
11

python windows os.listdir path usage

yourobject = os.listdir('C:\\Users\\test\\files')
Posted by: Guest on February-14-2021

Python Answers by Framework

Browse Popular Code Answers by Language