在web页面上,当分别嵌入<img>
、<link>
和<script>
标记时,图像、css和javascript等资源将由客户端的web浏览器加载。在
资源URL可以采用不同的形式,可以是完整的URL,例如:
http://cdn.mysite.com/images/animage.jpg
它可以是相对路径:
^{pr2}$或者只是对根的引用
/images/animage.jpg
如何在python中创建一个函数,它获取页面的URL和其中资源的URL,并确保返回完整的URL?在
例如:
def resource_url(page,resource):
## if the resource is a full URL, return that
## if not, use the page URL and the resource to return the full URL
相关问题 更多 >
编程相关推荐