Skip to content

How to List all Files/Folders/Directories in Python

If you need to list all Files, Folders, or Directories in Python code, then you can use the listdirs method from the os package.

import os print(os.listdir("/path/to/directory/")
Code language: Python (python)

See also  How to create an AWS Lambda in Terraform
Tags:
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x