I am getting the following syntax error when trying to add a hyperlink,I looked at the HTML code for href,HTML code seems right but python is throwing a syntax error..can anyone help?
Python code
msg_body=("<HTML><head></head>"
"<body>Test"
"<br>Hi All, <br>"
"<b>Wiki @<a href="%s">%s</a> (listed @ go\link) <br><br>"
"<b>Release notes:</b> %s <br><br>"
"<b>Host/Riva Build Combo:</b><br>%s<br><br>"
"<b>Loading instructions:</b><br>%s<br><br>"
"<b>CR fixes:</b><br>%s<br><br>"
"Thanks,<br>"
"B team"
"</body></html>"
) % (wikiURL,Releasenotes,table,Load_ins,crInfo)
Error:-
"<b>Wiki @<a href="%s">%s</a> (listed @ go\wbit) <br><br>" ^
SyntaxError: invalid syntax
msg_body="""<HTML><head></head>
<body>Test
<br>Hi All, <br>
<b>Wiki @<a href="%s">%s</a> (listed @ go\link) <br><br>
<b>Release notes:</b> %s <br><br>
<b>Host/Riva Build Combo:</b><br>%s<br><br>
<b>Loading instructions:</b><br>%s<br><br>
<b>CR fixes:</b><br>%s<br><br>
Thanks,<br>
B team
</body></html>
""" % (wikiURL, Releasenotes, table, Load_ins, crInfo)
Something else to point out; you may want to use:
<p> & </p>
instead of:
<br>
as it makes a paragraph. For instance:
<p> Hello world. This is a paragraph.</p>
it also makes a break from the last item.
Wrong line is
"<b>Wiki @<a href="%s">%s</a> (listed @ go\link) <br><br>"
You need to escape the quotes inside quotes like that:
"<b>Wiki @<a href=\"%s\">%s</a> (listed @ go\link) <br><br>"
like that:
'<b>Wiki @<a href="%s">%s</a> (listed @ go\link) <br><br>'
or (as suggested by @ragsagar) like that:
"""
<b>Wiki @<a href="%s">%s</a> (listed @ go\link) <br><br>
"""
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.