../ file path code example

Example 1: pathlib path of current file

from pathlib import Path

BASE_DIR = Path(__file__).resolve().parent.parent
TEMPLATES_DIR = BASE_DIR.joinpath('templates')

Example 2: html relative path

<!--The ./ means the contact.html file is in the same file 
as the file that is linked to it-->
<a href="./contact.html">Contact</a>

Example 3: html local image

<img src="c:\your file">

Example 4: get path from file path python

>>> import os
>>> os.path.split(os.path.abspath(existGDBPath))
('T:\\Data\\DBDesign', 'DBDesign_93_v141b.mdb')

Tags:

Css Example