Unicode strings

In this section, we are going to learn about how to print Unicode strings in Python. Python handles Unicode strings in a very easy way. The string type actually holds Unicode strings, not a sequence of bytes.

Start the python3 console in your system and start writing the following:

student@ubuntu:~/work$ python3
Python 3.6.6 (default, Sep 12 2018, 18:26:19)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> print ('u2713')

>>> print ('u2724')

>>> print ('u2750')

>>> print ('u2780')

>>> chinese = 'u4e16u754cu60a8u597d!
>>> chinese
----- (Meaning “Hello world!”)
>>>
>>> s = 'u092Eu0941u0902u092Cu0908'
>>> s
'मुंबई' ------(Unicode translated in Marathi)
>>>
>>> s = 'u10d2u10d0u10dbu10d0u10e0u10efu10ddu10d1u10d0'
>>> s
'გამარჯობა' ------(Meaning “Hello” in Georgian)
>>>
>>> s = 'u03b3u03b5u03b9u03b1u03c3u03b1u03c2'
>>> s
'γειασας' ------(Meaning “Hello” in Greek)
>>>

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset