#js脚本,拼接图片路径
##替换拼接页面中图片路径:
-$(function () {
$(‘img’).each(function () {
var imgpath = $(this).attr(‘src’)
imgpath = “{% static '” + imgpath + “’ %}”
$(this).attr(‘src’, imgpath)
})
console.log($('body').html())
})
-python脚本把页面中点点/去掉的图片路径:
a=open(‘index.html’,‘r’,encoding=‘utf8’)
b=a.read()
print(b)
b=b.replace(‘src="…’,‘src="’)
print(b)
c=open(‘text.html’,“w”,encoding=‘utf8’)
c.write(b)