Get the parent directory of a folder/file in python. Using the "os" library its possible using python.
Lets try to understand with an example
>>> import os
>>> os.path.dirname('D:\Workspace\8.0.0.0 - INT')
Output will be as: 'D:\\Workspace'
Same if want to get the parent directory of file,
>>> os.path.dirname('D:\Workspace\8.0.0.0 - INT\AdapterFactory.py')
Out put will be as: 'D:\\Workspace\\8.0.0.0 - INT'
Thanks.
>>> import os
>>> os.path.dirname('D:\Workspace\8.0.0.0 - INT')
Output will be as: 'D:\\Workspace'
Same if want to get the parent directory of file,
>>> os.path.dirname('D:\Workspace\8.0.0.0 - INT\AdapterFactory.py')
Out put will be as: 'D:\\Workspace\\8.0.0.0 - INT'
Thanks.
This post was very informative. Its really amazing blog with very much helpful information. I will bookmark your amazing site and i want visit here again. Thanks for sharing this.
ReplyDeletecatering prasmanan enak murah
pusulabet
ReplyDeletesex hattı
https://izmirkizlari.com
rulet siteleri
rexbet
LSTGK8