5

I'm using vscode and when I try to print this

print('شیرینی پزی')

the output of terminal is

ی‌ز‌پ ی‌ن‌ی‌ر‌ی‌ش

what should I do

0

1 Answer 1

6

Note: The following solution is for displaying the RTL texts. Don't use the output in your code. It's just for printing in wherever RTL texts are messed up.

First install arabic_reshaper and bidi

pip install arabic-reshaper
pip install python-bidi

Then, use the following function:

import arabic_reshaper
from bidi.algorithm import get_display

def convert(text):
    reshaped_text = arabic_reshaper.reshape(text)
    converted = get_display(reshaped_text)
    return converted
print(convert('شیرینی پزی'))

The output:

>>> شیرینی پزی
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.