To output a Unicode string, we must first encode the Unicode string as a standard string. To do this, we use Python's encode function in order to tell Python which encoding to use. For the Unicode strings of the previous page, we could write:
a = x.encode("utf-8")Then we can print them as usual or otherwise write them to a file-like object (e.g., local file, web page, etc.). Now that the values are assigned to other variables, we can reference those handles like any other variable:
b = y.encode("utf-8")
c = z.encode("utf-8")
>>> converted = (a, b, c)This is one way of converting Unicode strings to standard strings in Python. There is, however, a much easier way. Go to the next page of this tutorial to find out how.
>>> for i in converted:
... ÃÂ ÃÂ ÃÂ ÃÂ print i
...
é
Ãâ
áÆÅ¾
