Some quick Python 3 Unicode tips

Here are some quick tips for working wtih Python 3 unicode characters. Lets work with the the small delta Unicode character:  "δ".

1. Show the UTF-8 encoding:

In []: "δ".encode("utf-8")
Out[]: b'\xce\xb4'

2. Show the Unicode escape sequence (or code point value):

In []: "δ".encode("unicode_escape")
Out[]: b'\\u03b4'

3. Show the Ordinal value, which returns an Integer:

In []: ord("δ")
Out[]: 948

4. Show the Unicode code point from the Ordinal value:

In []: hex(948)
Out[]: '0x3b4'