Question: I am having a simple doubt..
 I am trying to join three parts of a string using urljoin..

```
   host = "http://foo.com:port"
   ver = "/v1"
   exten = "/path"

```

Rather than doing host+ver+exten, I want to use urljoin to generate url
 But urljoin is giving 
 `http://foo.com:poort/v1` ( if i try `urljoin(host,ver,exten)` )

Answer: 
The way `urljoin` works is by combining a base URL and another URL. You could try joining the relative paths together with simple string combinations, and then use `urljoin` to join the host and the combined relative path.

Like:

```
rel = ver + exten
url = urljoin(host, rel)

```

Sadly if you want to combine multiple URL paths, you will have to use another library. If you're using a non-Windows machine, you could use the os.path module to join them together just like you would combine a local file path.
You can also join your list of parts recursively:

```
def urljoin(parts):
    if len(parts) > 1:
        parts = [urllib.parse.urljoin(parts[0], parts[1])] + parts[2:]
        return urljoin(parts)

    return parts[0]

```

Use the function like this:

```
parts = [
    'https://stackoverflow.com/',
    'questions/24814657/',
    'how-to-do-url-join-in-python-using-multiple-parameters/',
    '41756140#41756140',
]

print(urljoin(parts))
# https://stackoverflow.com/questions/24814657/how-to-do-url-join-in-python-using-multiple-parameters/41756140#41756140

```

Note that `urllib.parse.urljoin()` has a bit different behavior than `os.path.join()` mentioned by @AnukuL.