How can I list all files in a directory using Python?

I am working on a project that requires me to list all the files in a directory using Python. I have tried using the os module, but I am not sure how to proceed. Can someone help me with the code and any tips on how to make this process more efficient?

Here’s the code:

I am able to list all the files in the directory, but I am not sure how to optimize this code or make it more efficient. Any help and suggestions are greatly appreciated.