I want it to produce the number next to a word so that I can ask the user to select the word by using the corresponding number.
This is my code
alt_w
Put a Right-to-Left Embedding character, u'\u202B'
, at the beginning of each Hebrew word, and a Pop Directional Formatting character, u'\u202C'
, at the end of each word.
This will set the Hebrew words apart as RTL sections in an otherwise LTR document.
(Note that while this will produce the correct output, you're also dependent on the terminal application in which you're running this script having implemented the Unicode Bidirectional Algorithm correctly.)