Write text to a text file in RTL format

103 views Asked by At

I have an array of text, I want to write it to a .txt file from right to left since it is in Arabic or Kurdish. How can I do that using python?

Method to write to a file:

with open(current_extracted_text_output_path, 'w', encoding='utf-8') as text_file:
    for line in extracted_lines:
        print(line)
        text_file.write(line + '\n')

Output:

enter image description here

0

There are 0 answers