Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<h1>Python</h1> <p>Python 2 has the classes <code>str</code> and <code>unicode</code>. <code>str</code> objects store bytes, <code>unicode</code> objects store UTF-16 characters. Most library functions support both (e.g. <code>os.listdir('.')</code> returns a list of <code>str</code>, <code>os.listdir(u'.')</code> returns a list of <code>unicode</code> objects). Both have <code>encode</code> and <code>decode</code> methods.</p> <p>Python 3 basically renamed <code>unicode</code> to <code>str</code>. The Python 3 equivalent to <code>str</code> would be the type <code>bytes</code>. <code>bytes</code> has a <code>decode</code> and <code>str</code> an <code>encode</code> method. <a href="http://www.python.org/dev/peps/pep-0393/" rel="nofollow noreferrer">Since Python 3.3</a> <code>str</code> objects internally use one of several encodings in order to save memory. For a Python programmer it still looks like an abstract unicode sequence.</p> <p>Python supports:</p> <ul> <li>encoding/decoding</li> <li>normalization</li> <li>simple case conversion and splitting on whitespace</li> <li>looking up characters by their name</li> </ul> <p>Python does not support/has limited support for:</p> <ul> <li>collation (limited)</li> <li>special case conversions where there is no 1:1 mapping between lower and upper case characters</li> <li>regular expressions (<a href="https://pypi.python.org/pypi/regex" rel="nofollow noreferrer">it's worked on</a>)</li> <li>text segmentation</li> <li>bidirectional text handling</li> </ul> <p>See also: <a href="http://www.cmlenz.net/archives/2008/07/the-truth-about-unicode-in-python" rel="nofollow noreferrer">The Truth about Unicode in Python</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload