This blog discuss how to use os module for printing current working directory along with list of files in current directory
Require to import os module in order to know current working directory and to display list of files
Use function os.getcwd() to display current working directory
Use function os.listdir() to display list of files in current directory or in a path specified
os.listdir()
Return a list of files in the directory specified by a path
If no path is specified, it display files from current working directory
It display files in arbitrary order
Below is the complete code to display current working directory and list of files
import os
print('Current Working Directory:',os.getcwd())
print('Below is the list files')
print((os.listdir()))
Output
Current Working Directory: C:\Users\rohit\PycharmProjects\pythonProject
Below is the list files
['.idea', 'main.py', 'venv']