write code that show current folder where python file executed in python

You can use the os module in Python to get the current working directory. Here's an example:

main.py
import os

current_directory = os.getcwd()
print("Current working directory:", current_directory)
98 chars
5 lines

The getcwd function from os module returns the current working directory as a string. You can store it in a variable and print it out as shown in the example.

related categories

gistlibby LogSnag