title: How to add classes and stylesheets to HTML in python?
body: <p>I am scraping data from API and inputting them into a html file using html_file.write method. I want to center the text and add borders and fonts etc.. but when I am adding for example .content class to &lt;style&gt; and writing  I got syntax error on container and a bunch of other stuff while using bootstrap.. How can I input them without syntax errors?</p>
  <pre><code>html_content=f&quot;&lt;html&gt;&lt;head&gt;&lt;meta http-equiv=\&quot;content-type\&quot; content=\&quot;text/html; charset=UTF-8\&quot;/&gt;&quot;+&quot;&quot;&quot;
       &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;
       &lt;link rel=&quot;stylesheet&quot; href=&quot;https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css&quot;&gt;
       &lt;link rel=&quot;preconnect&quot; href=&quot;https://fonts.gstatic.com&quot;&gt;
       &lt;link href=&quot;https://fonts.googleapis.com/css2?family=Questrial&amp;display=swap&quot; rel=&quot;stylesheet&quot;&gt;
       &lt;link rel=&quot;stylesheet&quot; href=&quot;style.css&quot;&gt;
      
       
       &lt;style&gt;
       .content {
          width: 50%;
           margin: auto;
         background: white;
          padding: 10px;
        }
  
      
        
       img{
       max-width: 100%;
        }
       body {background-color: LightGray;}
       h1   {color: red;}
       h2   {color: red;} 
           
       &lt;/style&gt;
        &quot;&quot;&quot;+f&quot;&lt;/head&gt;&lt;body&gt;&lt;div class=&quot;container&quot;&gt;&lt;h1&gt;&lt;h1&gt;&lt;font size='6'&gt;&lt;strong&gt;{Q}&lt;/strong&gt;&lt;/font&gt;&lt;/h1&gt;&lt;p&gt;{content2modified}&lt;/p&gt;&lt;hr&gt;&lt;h1&gt;&lt;font size='6'&gt;&lt;strong&gt;{A}&lt;/strong&gt;&lt;/font&gt;&lt;/h1&gt;&lt;p&gt;{contentmodified}&lt;/p&gt; &lt;/body&gt;&lt;/div&gt; &lt;/html&gt;&quot;
       with open(&quot;index.html&quot;,&quot;w&quot;,encoding='utf-8') as html_file:
          html_file.write(html_content)
          print(&quot;Success&quot;)
       await message.author.send(file=discord.File('index.html'))
  </code></pre>