+ 2

Can python work with arabic letters? If yeah, explain please.

if I want to print my english name I simply type 'print("Djaber")' waht should me do to print my arabic name?

20th Dec 2016, 8:44 PM
Djaber Meghar
Djaber Meghar - avatar
3 Respostas
+ 5
Djaber Meghar, pleased to meet. In my choice of profession I often encounter people with different ethnic backgrounds. In some very rare and extreme occasions we sometimes need to collaborate in order to enclose the contract. The result is quite enchanting when it appears to be more foreign characters in there than the opposite. Now onto your request... Arabic letters are encrypted in Unicode. To accomplish what you request we need to tell the python interpreter that we want to use different encoding and refer to the chart as followed below: TEST_FILE = codecs.open('test.ar', 'r',encoding='utf-8') p = re.compile(unicode('^????', 'utf-8'), re.U) for line in TEST_FILE: match = p.match(line) if match: print line.rstrip() print match.group().rstrip() TEST_FILE.close() Reference: Arabic letters - http://www.unicode.org/charts/PDF/U0600.pdf Let me know if you need any further assistance, Mr. Dr.
20th Dec 2016, 9:50 PM
Tristan McCullen
Tristan McCullen - avatar
+ 1
Python 3 works out of the box with ask Unicode characters. If you have to use Python 2 it's going to be more work.
20th Dec 2016, 9:16 PM
James Durand
James Durand - avatar
- 1
maybe Unicode formatting will help
20th Dec 2016, 8:53 PM
Demeth
Demeth - avatar