I am looking through some unit testing code and I found this:
self.assertIn(b'Hello', res.body)
I know that this means bytes
in Python 3 which returns a byte array, as I found here. 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 related question that I found had a poorly-written accepted answer with contradictory comments that confused me.
Questions:
- In what versions of python does
b'myString'
"work"? - How does it behave in python 2.x?
- How does it behave in python 3.x?
- Does that have something to do with the byte literal change?