Combine relative path with absolute path in Python

date: Aug 12, 2017

Recently I need to combine a absolute link with a relative link, so I tried to hard code it but failed. After checking online, there is actually a lib in Python called urlparse that have a function to combine this kind of url. the use is also simple:

from urlparse import urljoin
urljoin('', '../../images/img.png')


Creative Commons License
Unless specified, all the articles are licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Free Software Fundation Member

The site is proudly powered by Hexo hosted on GitHub Pages.

The site is powered by the glorious CSS from bettermotherf** with some tweaks. Censored the f-word for good.

Main | Access | CDN | RSS | Sitemap
2008 - 2021 | Patrick WU Jinming