简体   繁体   中英

How do I add a hyperlink using python script?

I am trying to add a hyperlink to an email I'm sending through python send mail. I'd like to add a link after blah blah blah. thanks in advance!

here is what i have so far:

code i already have

email = "test@gmail.com"
"this is my e-mail:{email}".format(
   email=email,
)

result is

this is my e-mail:test@gmail.com

is this what you want? i need more detail description

You could use str.format() for that purpose.

Example:

link = 'https://google.com'
mymail = 'Hello friend!\nCheck this out {}'.format(link)
print mymail

>>> Hello friend!
>>> Check this out https://google.com

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM