I am new to Python, and I am trying to change some text from English to French in a series of ArcGIS maps, using a Python script (running version 2.7.12) and editing it in IDLE. Following the suggestions in these posts
Write french characters in python 2.7
How to make the python interpreter correctly handle non-ASCII characters in string operations?
I used
#!/usr/bin/python2.7
# coding: utf-8
as the first lines of my script, and included a 'u' inside the brackets before the text with the French character. However, when I make the substitution, I can no longer save or run the script.
The following code generates the English text correctly:
if name[0] == "Alcids":
elm_spp.text = '\r\n'.join(textwrap.wrap("Alcids: ANMU, CAAU, COMU, MAMU,
PIGU, RHAU, UNAL",30))
The following does not allow me to save or run the script:
if name[0] == "Alcids":
elm_spp.text = '\r\n'.join(textwrap.wrap(u"Alcidés: GUCB, SCAS, GUMA,
GMRB, GUCO, MARH, ALSP",30))
Can anyone tell me what I am missing?
Thanks.