-2

www.pythonchallenge.com/pc/def/peak.html的来源如下:

<html>
<head>
  <title>peak hell</title>
  <link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body>
<center>
<img src="peakhell.jpg"/>
<br><font color="#c0c0ff">
pronounce it
<br>
<peakhell src="banner.p"/>
</body>
</html>

<!-- peak hell sounds familiar ? -->

www.pythonchallenge.com/pc/def/banner.p我可以通过右键单击并在 Firefox 中banner.p选择来获取 url ( )。copy link location如何仅使用 Python 获取此 url?

4

1 回答 1

1
>>> urlparse.urljoin('http://www.pythonchallenge.com/pc/def/peak.html', 'banner.p')
'http://www.pythonchallenge.com/pc/def/banner.p'
于 2012-09-25T14:58:31.277 回答