Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

right-to-left languages in Python

Tags:

python

hebrew

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 left to right?

like image 273
Or D Avatar asked Oct 04 '10 14:10

Or D


Video Answer


1 Answers

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("היי"))
like image 62
Stav Cohen Avatar answered Oct 26 '22 02:10

Stav Cohen