title: Python Checking a string's first and last character
body: <p>can anyone please explain what is wrong with this code?</p>
  
  <pre><code>str1='"xxx"'
  print str1
  if str1[:1].startswith('"'):
      if str1[:-1].endswith('"'):
          print "hi"
      else:
          print "condition fails"
  else:
      print "bye"   
  </code></pre>
  
  <p>The output I got is:</p>
  
  <pre class="lang-none prettyprint-override"><code>Condition fails
  </code></pre>
  
  <p>but I expected it to print <code>hi</code> instead.</p>