close

how to show current directory in ipython prompt

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about how to show current directory in ipython prompt in Python. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

Table of Contents

how to show current directory in ipython prompt?

  1. how to show current directory in ipython prompt?

    When interactive computing it is common to need to access the underlying shell. This is doable through the use of the exclamation mark ! (or bang) To execute a command when present in beginning of line.

  2. show current directory in ipython prompt

    When interactive computing it is common to need to access the underlying shell. This is doable through the use of the exclamation mark ! (or bang) To execute a command when present in beginning of line.

Method 1

You can use os.getcwd(current working directory) or in the native os command pwd.

In [8]: import os

In [9]: os.getcwd()
Out[9]: '/home/rockwool'

In [10]: pwd
Out[10]: '/home/rockwool'

Method 2

Using ! before pwd will show the current directory

In[1]: !pwd
/User/home/

When interactive computing it is common to need to access the underlying shell. This is doable through the use of the exclamation mark ! (or bang) To execute a command when present in beginning of line.

Summery

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

Also, Read