print contents of a directory python code example Example: python program to print the contents of a directory using os module import os li = os.listdir(".") print(li)