1

I read the following sentence in book "introducing python"

Python 3 strings are Unicode strings, not byte arrays. This is the single largest change from Python 2, which distinguished between normal byte strings and Unicode character strings.

I am very confused here, I tested respectively in python3 and python2

in python 3

In [12]: s = "python3"
In [13]: type(s)
Out[13]: str

In python2:

>>> s = "python2"
>>> type(s)
<type 'str'>

They are of the identical type.

How could I find the description "byte arrays" in "python2"?

AbstProcDo
  • 19,953
  • 19
  • 81
  • 138
  • Strongly related: https://stackoverflow.com/questions/10060411/byte-string-vs-unicode-string-python – colidyre Sep 27 '18 at 23:22
  • The fact that the type of a string is named `str` in both Python 2 and Python 3 means nothing for whether those strings are Unicode or bytestrings. – user2357112 Sep 27 '18 at 23:37
  • Possible duplicate of [byte string vs. unicode string. Python](https://stackoverflow.com/questions/10060411/byte-string-vs-unicode-string-python) – J. Blackadar Sep 28 '18 at 05:18

0 Answers0