Reputation: 93
I'm using vscode and when I try to print this
print('شیرینی پزی')
the output of terminal is
یزپ ینیریش
what should I do
Upvotes: 5
Views: 1537
Reputation: 394
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:
>>> شیرینی پزی
Upvotes: 6