I have a string x defined as below
x = b'LF \xa9 2020 by S&P Global Inc.,200523\n'
In iPython2
In [10]: x
Out[10]: 'LF \xa9 2020 by S&P Global Inc.,200523\n'
In [11]: print(x)
LF � 2020 by S&P Global Inc.,200523
In [12]: x.decode('ISO-8859-1')
Out[12]: u'LF \xa9 2020 by S&P Global Inc.,200523\n'
In [13]: print(x.decode('ISO-8859-1'))
LF © 2020 by S&P Global Inc.,200523
Question 1: why is the output for x and print(x) different? The same between x.decode('ISO-8859-1') and print(x.decode('ISO-8859-1')).
In iPython3
In [3]: x
Out[3]: b'LF \xa9 2020 by S&P Global Inc.,200523\n'
In [4]: print(x)
b'LF \xa9 2020 by S&P Global Inc.,200523\n'
In [5]: x.decode('ISO-8859-1')
Out[5]: 'LF © 2020 by S&P Global Inc.,200523\n'
In [7]: print(x.decode('ISO-8859-1'))
LF © 2020 by S&P Global Inc.,200523
Question 2: As you can see, in Python3, the output for x and print(x) are the same. So are x.decode('ISO-8859-1') and print(x.decode('ISO-8859-1')). In Python2, it is not the case. Why is this distinction between Python2 and Python3?
Question 3: why the output of print(x) in Python 2 and 3 are different, the output of x is the same?
Question 4: why the output of x.decode('ISO-8859-1') in Python 2 and 3 are different, but print are the same?