Print Urdu/Arabic Language in Console (Python)

2019-07-09 12:08发布

I am a newbie and i don't know how to set my console to print urdu / arabic characters i am using Wing IDE when i run this code

print "طجکسعبکبطکسبطب"

i get this on my console

طجکسعبکبطکسبطب

1条回答
forever°为你锁心
2楼-- · 2019-07-09 12:43

You should encode your string arguments as unicode UTF-8 or later. Wrap the whole code in unicode, and/or mark individual string args as unicode (u'your text') too.

Additionally, you should make sure that unicode is enabled in your terminal/prompt window too.

#!/usr/bin/env python
# -*- coding: UTF-8 -*-

arabic_words = u'لغت العربیه'

print arabic_words

enter image description here

查看更多
登录 后发表回答