View Single Post
  #3  
Old 10-18-2013, 01:03 AM
dig dig is offline
Member
 
Join Date: Apr 2006
Posts: 15
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
Reply With Quote