i want to use lines of model.txt in my code but all of words in lines are persian(Right to Left).i use this code for correct them but its give me error. i know how i can solve error but if i change my lines to strings i cant correct their shape and direction.any help?
import arabic_reshaper
from bidi.algorithm import get_display
def readFile():
with open('D:/visual stadio/python/captcha maker/test/model.txt','r') as file:
lines= file.readlines()
reshaped_text = arabic_reshaper.reshape(lines)
#if i use reshaped_text = arabic_reshaper.reshape(str(lines)) it will
#work fine but it will give me this answer: ['سلام\n',
#'سلامس\n', 'آدامس\n', 'پنیر\n', 'چتر\n','پاوه'] this are my words in model.txt but not fixed.
bidi_text = get_display(reshaped_text)
return bidi_text
bidi_text=readFile()
print(bidi_text)