2016-09-28 4 views
2
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 characterString Ausgabe in Python

Es sieht normal. Wie sollte ich es beheben?

+0

Setzen Sie eine neue Zeile nach dem '\\'? – mgilson

Antwort

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

Genau dort ist Ihr Problem. Der umgekehrte Schrägstrich ist das Zeilenfortsetzungszeichen, das der Fehler erwähnt. Hol es raus.

0
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 ----------------------------------^