mysterious unicode
Gerry
gerard.blais at gmail.com
Tue Mar 20 18:35:00 EDT 2007
I'm using pyExcelerator and xlrd to read and write data from and to
two spreadsheets.
I created the "read" spreadsheet by importing a text file - and I had
no unicode aspirations.
When I read a cell, it appears to be unicode u'Q1", say.
I can try cleaning it, like this:
try:
s.encode("ascii", "replace")
except AttributeError:
pass
which seems to work. Here's the mysterious part (aside from why
anything was unicode in the first place):
print >> debug, "c=", col, "r=", row, "v=", value,
"qno=", qno
tuple = (qno, family)
try:
data[tuple].append(value)
except:
data[tuple] = [value]
print >> debug, "!!!", col, row, qno, family, tuple,
value, data[tuple]
which produces:
c= 1 r= 3 v= 4 qno= Q1
!!! 1 3 Q1 O (u'Q1', 'O') 4 [1, u' ', 4]
where qno seems to be a vanilla Q1, but a tuple using qno is
(u'Q1', ...).
Can somebody help me out?
More information about the Python-list
mailing list