[Tutor] (no subject)

Steven D'Aprano steve at pearwood.info
Mon Jul 25 06:28:29 EDT 2016

On Fri, Jul 22, 2016 at 01:08:02PM +0530, DiliupG wrote:
> I am using Python 2.7.12 on Windows 10

Two errors:

- first error is that Unicode strings in Python 2 need to be written as 
unicode objects, with a "u" prefix in the delimiter:

# ASCII byte string:
"Hello World"

# Unicode string:

u"මේක ත"

ASCII strings "..." cannot give you the right results except by 
accident. You must use unicode strings u"..."

- Second possible problem: using Windows, which may not support the 
characters you are trying to use. I don't know -- try it and see. If it 
still doesn't work, then blame Windows. I know that Linux and Mac OS X 
both use UTF-8 for filenames, and so support all of Unicode. But 
Windows, I'm not sure. It might be localised to only use Latin-1 
(Western European) or similar.


More information about the Tutor mailing list