相对路径edi

2024-06-14 14:02:07 发布

您现在位置:Python中文网/ 问答频道 /正文

我在python中工作 我正在用selenium解析来自不同网店的代码,并将它们打印到一个用flask制作的概览页面上

webshopresultaten = resultatenlijstwebshop.get_attribute('outerHTML')#getting the HTML code from the by selenium recognized part of the suppliers website print("<h1>webshop resultaten</h1>" + webshopresultaten) liresultaten = "<h1>webshop resultaten</h1>" + webshopsresultaten #adding a title to this list return render_template("interface.html", liresultaten=liresultaten) #using flask to show the HTML snippet from suppliers page on my page

因此,webshopresultaten变量给了我一个供应商网站的片段,我想用flask在本地托管的网页上打印它 一切正常,唯一的问题是供应商网站的HTML代码片段中包含以下内容

href="ajaxElement/imgProtect_2y10WMa3vtEp7msffVjVRPy4Of44HBmRSGVcDrf7Z4A9JMEoGSZM8li.jpg"

如何使此链接引用供应商的域名,使图片在本地托管页面中可见


Tags: theto代码fromflaskhtmlselenium页面