Using os and os.path for File System Interactions in Python


Interact with the file system to get file properties, navigate directories, and more.

Source Code

import os
# Get current working directory
current_dir = os.getcwd()
print(current_dir)
# List all files and directories in the current directory
print(os.listdir(current_dir))
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments