Get the working directory

To start working with directories, first, we will get the name of our current working directory. The os module has a getcwd() function, using which we can get the current working directory. Start the python3 console and enter the following commands to get the directory name:

$ python3
Python 3.6.5 (default, Apr 1 2018, 05:46:30)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.getcwd()
'/home/student'
>>
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset