Python absolute path of file, dirname, join

Python absolute path of file, dirname, join

<div>
<div>import os</div>
<div>print(__file__)</div>
<div>print(os.path.abspath(__file__))</div>
<div>print(os.path.dirname(__file__))</div>
<div>print(os.path.dirname(os.path.abspath(__file__)))</div>
<div>print(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))</div>
<div>BASE_DIR = os.path.dirname(os.path.abspath(__file__))</div>
<div>print(os.path.join(BASE_DIR,"templates"))</div>
</div>

 

python absolute path join dirname

Tony BB
 

TonyBB is a Coach , marketer, hypnotist and a founder of RSKVF Production who specializes in providing simple, affordable, and easy to use solutions for Life.

Click Here to Leave a Comment Below 0 comments

Leave a Reply: