相対 URL から絶対 URL を作成するときに「無効な」親ディレクトリを説明する方法はあります.replace()
か?
>>> from urlparse import urljoin
>>> url = urljoin('http://www.example.com/path/', '../../../index.html')
>>> url
'http://www.example.com/../../index.html'
>>> url.replace('../', '')
'http://www.example.com/index.html'
さらに良いことに、Python でスクレイピングするときに URL をサニタイズするよりクリーンな方法はありますか?