I am writing HTML to a file, suddenly I came accross this problem here:
theBody = "<h1>example</h1>"
with open("/home/mathew/Desktop/finalText.html", "w") as output:
print("""<!doctype html>
<html>
<head>
<style>
body{
background: #000;
color: #fff;
font-size: 2em;
}
</style>
</head>
<body>
{}
</body>
</html>
""".format(theBody), file=output)
The error I am facing is:
Traceback (most recent call last):
File "/root/PycharmProjects/API/index.py", line 14, in <module>
print("""<!doctype html>
KeyError: '\n background'