title: How do I encode a string to bytes in the send method of a socket connection in one line?
body: <p>In Python 3.5, using sockets, I have:</p>
  
  <pre><code>message = 'HTTP/1.1 200 OK\nContent-Type: text/html\n\n'
  s.send(message.encode())
  </code></pre>
  
  <p>How can I do that in one line?  I ask because I had:</p>
  
  <pre><code>s.send('HTTP/1.1 200 OK\nContent-Type: text/html\n\n')
  </code></pre>
  
  <p>but in Python 3.5 bytes are required, not a string, so this gives the error:</p>
  
  <pre><code>builtins.TypeError: a bytes-like object is required, not 'str'
  </code></pre>
  
  <p>Should I not be using send?</p>