Question: I am doing content linking check on user's upload zip file with Python's zipfile and BeautifulSoup module. 

In the zip file, there is a file "a.html" and its full path in the zip file is "content/product1/component1/a.html". File 'a.html' has a `<a href="../../product2/component2/b.html">` link to another HTML file. 

I want to know how to combine the path "content/product1/component1/a.html" with "../../product2/component2/b.html" and get the right path which is "content/product2/component2/b.html". So I can check where this file exists.

I tried `os.path.join("content/product1/component1/a.html","../../product2/component2/b.html)`, but I don't get "content/product2/component2/b.html". Does anyone know how to do that?

Answer: 
You need to extract the path component from "content/product1/component1/a.html", join that to the "../../product2/component2/b.html" href, and then normalize the result.

```
import os.path

src = "content/product1/component1/a.html"
srcdir = os.path.dirname(src)

href = "../../product2/component2/b.html"
url = os.path.normpath(os.path.join(srcdir, href))
print(url)

```

**output**

```
content/product2/component2/b.html

```
You might want to try using [`str.split()`](https://docs.python.org/3/library/stdtypes.html#str.split) (with `/` as the separator) and *then* use `os.path.join()` on the parts you need.