Reputation: 5127
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
Upvotes: 1
Views: 1516
Reputation: 2374
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)
Upvotes: 4
Reputation: 34004
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>
"""
Upvotes: 0