TECHIES WORLD

For Techs.... Techniques.... Technologies....

LinuxPython

List the contents of a folder in Python

Os module provides the functionality to list the contents of folders.

import os
os.listdir(foldername)

Where 'foldername' is the name of the folder for which the contents need to be listed.

 

Leave a Reply