Print Urdu/Arabic Language in Console (Python)

我怕爱的太早我们不能终老 提交于 2019-12-11 00:32:04

问题


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:


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



来源:https://stackoverflow.com/questions/35252138/print-urdu-arabic-language-in-console-python

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!