Thanks for the reply Jeff. Unfortunately, it doesn't seem to work (unless I did something stupid of course). Here's my code:
for line in JRDfile:
s = line.split()
asciidata0=s[0].encode("ascii","ignore")
asciidata1=s[1].encode("ascii","ignore")
thisTrial = [float(asciidata0),float(asciidata1),s[2],s[3],s[4]]
JRDTrials.append(thisTrial)
And here's the error message I get:
Traceback (most recent call last):
File "<string>", line 11, in ?
File "Anthi_JRD.py", line 41, in ?
asciidata0=s[0].encode("ascii","ignore")
UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 0: ordinal not in range(128)
Note the the text file I'm trying to read from is in UTF-8 format.
Cheers,
marios
|