title: Python string "b" prefix (byte literals)
body: <p>I am looking through some unit testing code and I found this:</p>
  
  <pre><code>self.assertIn(b'Hello', res.body)
  </code></pre>
  
  <p>I know that this means <a href="http://docs.python.org/3/reference/lexical_analysis.html#literals" rel="nofollow noreferrer"><code>bytes</code></a> in Python 3 which <a href="http://docs.python.org/3/library/functions.html#bytes" rel="nofollow noreferrer">returns a byte array</a>, as I found <a href="https://stackoverflow.com/a/2592818/2502012">here</a>.  I believe that the code was written for Python 3.3 and am trying to figure out how it works in other versions (in my case 2.7)  The <a href="https://stackoverflow.com/questions/2592764/what-does-a-b-prefix-before-a-python-string-means">related question</a> that I found had a poorly-written accepted answer with contradictory comments that confused me.</p>
  
  <p><strong>Questions:</strong></p>
  
  <ul>
  <li>In what versions of python does <code>b'myString'</code> "work"?</li>
  <li>How does it behave in python 2.x?</li>
  <li>How does it behave in python 3.x?</li>
  <li>Does that have something to do with the <a href="http://docs.python.org/2/whatsnew/2.6.html#pep-3112-byte-literals" rel="nofollow noreferrer">byte literal change</a>?</li>
  </ul>