right-to-left languages in Python

后端 未结 2 1428
予麋鹿
予麋鹿 2020-12-17 21:06

I want to write a Hebrew string in Python and then show it onscreen. The problem is that I get a mirror view of what I wrote. How can I set the string to use RTL instead of

相关标签:
2条回答
  • 2020-12-17 21:36

    did you try this?

    http://pypi.python.org/pypi/python-bidi/

    http://pypi.python.org/pypi/django-bidi-utils

    the Israeli FOSS comunnity is doing a lot in the direction, suprisingly, they happily collaborate also with Farsi speakers :-)

    pyfribidi for windows or any other bidi algorithm

    0 讨论(0)
  • 2020-12-17 21:44

    I know I'm pretty late to the party, but you can always use:

     " שלום hello "[::-1]
    

    But the real solution is to use:

    from bidi.algorithm import get_display
    print(get_display("היי"))
    
    0 讨论(0)
提交回复
热议问题