【发布时间】:2026-02-01 04:00:02
【问题描述】:
<html>
<body>
<h2>HTML Iframes</h2>
<p>You can use the height and width attributes to specify the size of the iframe:</p>
<iframe src="https://www.google.com/maps/embed/v1/place?key=AIzaSyAPi0wzs7IlNc4nlL3atU7iCd-A9QXfuHs&q=4.5596%2C-76.2801&zoom=18&maptype=satellite" height="200" width="300"></iframe>
</body>
</html>
所以在我的计算机上创建了这个 html 文件,现在我需要将 src 之后的内容更改为新字符串,例如 -
那么如何在 src= 之后将该示例行添加到 html 文件中?
【问题讨论】:
-
所以您问如何更改
iframe标签的src? -
是的,我的 url 数据每天都在变化,我需要保持 src 更新
-
您可能必须手动更改它
-
@AlexShakhnovskiy 您可以使用
BeautifulSoup获取 iframe 标签并更改 src。 -
嗯,我想过,但它每隔几个小时左右就会改变一次,所以每当我运行代码时,我都必须更新它。这应该是可能的,但我知道如何实现它