Bonjour à tous,

Aujourd'hui je m'intéresse à la lecture d'un fichier excel pouvant contenir des caractères spéciaux comme ü,ö,ä...
Je souhaite faire un petit script afin que tous les caractères spéciaux soient remplacés par des normaux u,o,a....

j'ai commencé un petit quelque chose mais je ne m'en sort pas.
Voici le code en question :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 
import sys
import os
import xlrd
#import unicodedata
 
path1 = 'P:/GH-DE-HE/__Tools/Libraries/GIS/Vergleichsanlagen/A/STG_Ahrensbök.xls'
path2 ='P:/GH-DE-HE/__Tools/Libraries/GIS/Vergleichsanlagen/A/STG_Ahrenvoil.xls'
 
val = []
accents = { 'a': ['à', 'ã', 'á', 'â'], 'e': ['é', 'è', 'ê', 'ë'],'i': ['î', 'ï'],'u': ['ù', 'ü', 'û'], 'o': ['ô', 'ö'] }
non_accents= ['a','o','e','u','i']
 
book = xlrd.open_workbook(path2)
sh = book.sheet_by_index(1)
 
for rownum in range(sh.nrows):            
    val.append(sh.row_values(rownum)) 
 
for (char, accented_chars) in accents.iteritems():
    for accented_char in accented_chars:
        for i in val:
            for j in i :
                re = j.replace(accented_char, char)
Voici mon message d'erreur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 0: ordinal not in range(128)
Pourriez vous m'indiquer par où chercher pour faire ce que je souhaite et pourquoi est ce que j'ai ce message d'erreur ?

Merci d'avance !
Ps:En pj un fichier excel exempleSTG_Ahrenvoil.zip