Suspected Unicode problem when reading from excell
maxm
maxm at normik.dk
Wed Sep 5 07:56:11 EDT 2001
I have the following code snippet that works sort of ok.
import win32com.client
xl=win32com.client.Dispatch("Excel.Application")
xl.Visible=1
wb=xl.Workbooks(1)
sh=wb.Worksheets(1)
for row in sh.UsedRange.Value:
(type, question, options, answerText, beforePic,
afterPic, misc1, misc2, misc3, misc4) = row
print question, options, answerText
But when I run it I get the following error:
>>> File "C:\div\uninstalled\python\excell\jensMarius.py", line 9, in ?
>>> print question, options, answerText
>>>UnicodeError: ASCII encoding error: ordinal not in range(128)
If I replace line 9 with this block, it prints out every question without
Danish characters.
try:
print question
except:
pass
So my guess is that it's caused by a problem with Danish characters.
Has anybody got a possible solution?
regards Max M
More information about the Python-list
mailing list