we have a list with arabic words for exmple
list[0]="هذه"
list[1]="هذا"
list[2]="ذلک"
and we need write each item of that list to a text file in index order and separate them by | character example of written file is
list[0]|list[1]|list[2]
and in example of question output must be
The first word to be written in the file : هذه
The second word to be written in the file :هذا
And the third word to be written in the file :ذلک
but output of file is similar below
هذه|هذا|ذلک
the هذه word must be first and ذلک must be last but it is reverse
the code is
tf = open("temp file.txt", "w",encoding="utf8")
tf.write("هذه")
tf.write('|')
tf.write("هذا")
tf.write('|')
tf.write("ذلک")
tf.write('|')
how can i fix it ?