0

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

asked Feb 6, 2015 at 6:15
8
  • 3
    b = (u'\u068\u0627\u0646\u0627', 'NN') assignment shows syntax error for me. Commented Feb 6, 2015 at 6:17
  • ...because \u068 is not a valid Unicode escape sequence. Commented Feb 6, 2015 at 6:19
  • I have made an error while copying and have modified it Commented Feb 6, 2015 at 6:20
  • What do you want it to print? If I fix the Unicode error in your example code, it does print something. Not "haha" but some characters I don't recognize: وانا - which Google Translate from Arabic says might mean "And I". Commented Feb 6, 2015 at 6:20
  • 1
    Make sure to look at the right side of your terminal. It prints right-to-left. And make sure your terminal or emulator is configured for UTF-8 display. Commented Feb 6, 2015 at 6:21

2 Answers 2

1

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.

answered Feb 6, 2015 at 6:29
Sign up to request clarification or add additional context in comments.

Comments

0

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.

answered Feb 6, 2015 at 6:22

1 Comment

Obsolete answer generated from comment.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.