I want to get the current file\'s directory path. I tried:
>>> os.path.abspath(__file__)
\'C:\\\\python27\\\\test.py\'
But how can
IPython
has a magic command %pwd
to get the present working directory. It can be used in following way:
from IPython.terminal.embed import InteractiveShellEmbed
ip_shell = InteractiveShellEmbed()
present_working_directory = ip_shell.magic("%pwd")
On IPython Jupyter Notebook %pwd
can be used directly as following:
present_working_directory = %pwd