2.0c1 Tutorial 3.1.3 unicode example problem

John W. Baxter jwbnews at scandaroon.com
Sun Oct 15 15:19:29 EDT 2000


The example near the start of the 2.0c1 Tutorial (as downloaded to here) 
appears flawed:

The small "u" in front of the quote indicates that an Unicode string is 
supposed to be created. If you want to include special characters in the 
string, you can do so by using the Python Unicode-Escape encoding. The 
following example shows how: 

>>> u'Hello\\u0020World !'
u'Hello World !'

In fact, the result of doing that (both on Linux (RH 6.2) and on Mac 
(Jack's Python 2.0c1 distribution) is:

>>> u'Hello\\u0020World !'
u'Hello\\u0020World !'

While a single \ works as described for the \\:
>>> u'Hello\u0020World !'
u'Hello World !'


My guess is the problem is in the tutorial, not in Python.

  --John

-- 
John W. Baxter   Port Ludlow, WA USA  jwbnews at scandaroon.com



More information about the Python-list mailing list