How do I get a list of all files (and directories) in a given directory in Python?
Answer / Anoop Singh
You can get a list of all files and directories in a given directory using the os module's listdir() function. For example: nimport osndir_path = '/my/directory'ndirs_and_files = os.listdir(dir_path)
| Is This Answer Correct ? | 0 Yes | 0 No |
Write a program in python to execute the bubble sort algorithm.
Can I learn python without knowing html?
How to create a unicode string in python?
Is self a keyword in python?
What are membership operators in python?
Differentiate between the append() and extend() methods of a list?
Do python arrays start at 0 or 1?
How do I start learning python?
How will you locally save an image using its url address?
What are the types of inheritance in python?
What is setup script?
Does python have private?