title: How to encode a string in python3.6..?
body: <p>My code is </p>
  
  <pre><code>import base64
  var = "this is a program for string capitalize method"
  var1 = base64.b64encode(bytes('var','utf-8'))
  print("String Encode:",end=''),print(var1.encode('base64','strict'))
  </code></pre>
  
  <p>but I am getting the following error:</p>
  
  <blockquote>
    <p>AttributeError: 'bytes' object has no attribute 'encode'</p>
  </blockquote>