Jonathan Cheng
Jonathan Cheng

Reputation: 479

String Output in Python

 html_body += "<tr><td>{}</td><td>{}</td><td>{}</td><td>{}</td>".\format(p[0],p[1],p[2],p[3])
                                                                                           ^

SyntaxError: unexpected character after line continuation character

It looks normal. how should i fix it?

Upvotes: 2

Views: 57

Answers (2)

Ayush
Ayush

Reputation: 42450

html_body += "<tr><td>{}</td><td>{}</td><td>{}</td><td>{}</td>".\format(p[0],p[1],p[2],p[3])
this backslash is not needed ----------------------------------^

Upvotes: 0

John Griffin
John Griffin

Reputation: 377

html_body += "<tr><td>{}</td><td>{}</td><td>{}</td><td>{}</td>".\form
                                                                ^

Right there is your problem. The backslash is the line-continuation character that the error mentions. Take it out.

Upvotes: 1

Related Questions