aceminer
aceminer

Reputation: 4295

printing unicode characters from a tuple in python

I do not understand this issue where my printing does not work

b = (u'\u0648\u0627\u0646\u0627', 'NN')
print b[0] 

Output

**Nothing is printed**

However this works

b = ("haha", "hehe")
print b[0] 

Output

haha

Upvotes: 0

Views: 181

Answers (2)

John Zwinck
John Zwinck

Reputation: 249652

The answer seems to be that it's Arabic script, which prints right-to-left, so you may have missed it on the right-hand side of your screen.

Also you may need to set your terminal or emulator to UTF-8.

Upvotes: 1

kid
kid

Reputation: 153

Hey just check you have provided a wrong hexadecimal unicode

b = (u'\u068\u0627\u0646\u0627', 'NN')
            ^

3 digit hex try using

 b = (u'\u0683\u0627\u0646\u0627', 'NN')
 b[0]

prints right value as expected.

Upvotes: 0

Related Questions