January 2019
Beginner
318 pages
8h 23m
English
Now, we are going to learn about os.path(). It is used for path manipulations. In this section, we will look at some of the functions that the os module offers for pathnames.
Start the python3 console:
student@ubuntu:~$ python3Python 3.6.6 (default, Sep 12 2018, 18:26:19)[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linuxType "help", "copyright", "credits" or "license" for more information.>>
>>> import os>>> os.path.abspath('sample.txt')'/home/student/work/sample.txt'
>>> os.path.dirname('/home/student/work/sample.txt')'/home/student/work'
Read now
Unlock full access