【问题标题】:Create hyperlink and give it an appealing name in Python在 Python 中创建超链接并为其命名
【发布时间】:2021-11-15 04:03:47
【问题描述】:

我正在尝试重命名我的超链接以放置在 pdf 文件中。因此,我不想给用户一个巨大的长链接。 假设我的链接是这样的:

https://www.google.com/search?q=images+of+dogs&rlz=1C1OKWM_esES969ES969&sxsrf=AOaemvJFDb3FKdXO1Yqb3A1BdjWNfw0Edg:1632237403618&tbm=isch&source=iu&ictx=1&fir=D5X9VdSPli-xYM%252CHUMB4Zy1hHwFaM%252C_&vet=1&usg=AI4_-kShuarwW69ikZrP2YUHRVOpRHKKfQ&sa=X&ved=2ahUKEwiPs4aVrpDzAhUR1RoKHQiNAZIQ9QF6BAgPEAE&biw=2133&bih=1013&dpr=0.9#imgrc=D5X9VdSPli-xYM

我希望它出现在 pdf 中,例如: “图片链接”

My code: 
texto_body=f"Hi,<br> <br> This is a test with a link {link} <br> <br> Thanks,"

  body=f"""\
          <html>
              <body>
                <p style="color:black;"> {texto_body}</p>
                <img src="cid:image1" alt="Logo" style="width:90px;height:90px;"><br>
              </body>
          </html>
"""

【问题讨论】:

  • 请提供足够的代码,以便其他人更好地理解或重现问题。

标签: python string hyperlink


【解决方案1】:

解决了。我发现&lt;a href="where/you/want/the/link/to/go"&gt;text of the link&lt;/a&gt; 是使用给定名称设置超链接的方法

【讨论】:

    猜你喜欢
    • 2021-12-29
    • 2012-11-07
    • 1970-01-01
    • 2018-10-18
    • 2019-06-12
    • 1970-01-01
    • 1970-01-01
    • 2011-05-17
    • 1970-01-01
    相关资源
    最近更新 更多