You need to use OS library of python to do this. Please see the following sample code:
filenames = next(os.walk(path_to_directory))
Replace path_to_directory with your directory path. The output filenames will be a list with all files in that directory.
>>> filenames = next(os.walk('/home/pkumar81/'))
['.bash_logout', '.bash_profile', '.bashrc', '.emacs', '.bash_history', '.lesshst'.......]
You can also use the glob module that provides the function glob() to list all the files in a directory.
filenames = glob.glob('*.*')