Im using python V2.7, I have an array ArbSyn that has arabic string but they are stored as unicode, I want to convert them to normal Arabic letter and store them in the array ArbSynFinal. When I print encoded its printed in arabic letters but when I store it in ArbSynFinal using ArbSynFinal.append() and print it, its in unicode again, how can I solve this problem ?
print("----ArbSyn----")
print ArbSyn
ArbSynFinal=[]
for bca in ArbSyn: #Converting from unicode to arabic done
encoded=bca.encode('utf-8')#this works fine
encoded= u"".join([c for c in bca if not unicodedata.combining(c)])
print encoded
ArbSynFinal.append(encoded)
print("------Arb Syn Final----------")
print ArbSynFinal
This is the output:
----ArbSyn----
[u'\u0627\u0642\u062a\u0631\u062d', u'\u0627\u062d\u062f\u0627\u062b', u'\u0645\u0648\u0633\u0633', u'\u0631\u0627\u062f', u'\u062a\u0633\u064a\u0633', u'\u0627\u062d\u062f\u0627\u062b',]
اقترح
احداث
موسس
راد
تسيس
احداث
------Arb Syn Final----------
[u'\u0627\u0642\u062a\u0631\u062d', u'\u0627\u062d\u062f\u0627\u062b', u'\u0645\u0648\u0633\u0633', u'\u0631\u0627\u062f', u'\u062a\u0633\u064a\u0633', u'\u0627\u062d\u062f\u0627\u062b']