Q3
What does `os.listdir()` return?
💬Answer
os.listdir(path) returns a list containing the names of the entries (both files and subdirectories) inside the specified directory, excluding . and ...
import os
print(os.listdir("/tmp")) # Output: ['file1.txt', 'cache_dir']
Related Python Questions
View All PythonQuestions →
Created by
Apurv Gujjar
DevOps & Cloud Engineer
Specialized in:DevOpsAWSGCPKubernetesTerraformDocker
View Portfolio