June 2017
Beginner
352 pages
8h 39m
English
Strings are fully Unicode capable, so you can use them with international characters easily, even in literals, because the default source code encoding for Python 3 is UTF-8. For example, if you have access to Norwegian characters, you can simply enter this:
>>> "Vi er så glad for å høre og lære om Python!"'Vi er så glad for å høre og lære om Python!'
Alternatively, you can use the hexadecimal representations of Unicode code points as an escape sequence prefixed by \u:
>>> "Vi er s\u00e5 glad for \u00e5 h\xf8re og l\u00e6re om Python!"'Vi er så glad for å høre og lære om Python!'
We're sure you'll agree, though, that this is somewhat more unwieldy.
Similarly, you can use the \x escape sequence followed by a 2-character ...
Read now
Unlock full access