9951 explained code solutions for 126 technologies


pythonHow to list files in current directory


import os
filenames = os.listdir()
print(filenames)ctrl + c
os

module which provides functions for interacting with the operating system

os.listdir

returns the list of string as file names of the working directory (where python is currently running)