Hi,
I downloaded a csv database with names and dates etc..
I can read it partially, line per line, split on ',' and get the values i want;
Except that some of the lines, especially the first name of the person, have strange chars.
I cannot even read past the first occurrence like this.
How can i read past these chars and not loose the rest of the line ?
1924,"DUPONT, Clément",FRA,Men,Rugby,Silver
I downloaded a csv database with names and dates etc..
I can read it partially, line per line, split on ',' and get the values i want;
Except that some of the lines, especially the first name of the person, have strange chars.
I cannot even read past the first occurrence like this.
How can i read past these chars and not loose the rest of the line ?
1924,"DUPONT, Clément",FRA,Men,Rugby,Silver
f = open(file,'r') for line in f: try: l = line[:-1] l = l.split(',') except: pass f.close()
Output:Traceback (most recent call last):
File "E:/Python/Olympics2.py", line 13, in <module>
for line in f:
File "K:\Python383\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 6872: character maps to <undefined>
It is more important to do the right thing, than to do the thing right.(P.Drucker)
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.