right-to-left languages in Python

后端 未结 2 1430
予麋鹿
予麋鹿 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: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("היי"))
    

提交回复
热议问题