1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| def supprime_accent(ligne):
#supprime les accents du texte source
accents = { 'a': ['à', 'ã', 'á', 'â'],
'c': ['ç'],
'e': ['é', 'è', 'ê', 'ë'],
'i': ['î', 'ï'],
'u': ['ù', 'ü', 'û'],
'o': ['ô', 'ö'] }
for (char, accented_chars) in accents.iteritems():
for accented_char in accented_chars:
ligne = ligne.replace(accented_char, char)
return ligne
def AjoutePays(self,event):
ComboOuv=open(ComboDir,'r')
exec(ComboOuv)
ComboOuv.close()
NouveauPays = self.SaisiePays.GetValue()
NPaysAcc = supprime_accent(NouveauPays)
NPaysMaj = NPaysAcc.upper()
if (NouveauPays in ListePays):
print "Ce pays existe deja !"
print NPaysMaj
print ListePays
pass |
Partager