[Tutor] Re: hex to decimal conversion.

Thomi Richards thomi@thomi.imail.net.nz
Fri Nov 15 18:13:03 2002


i think this pretty much sums up my frustrations:

>>> pal.data[0]
'\xff'
>>> print pal.data[0]
ÿ
>>> print '%i' % (pal.data[0])
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: an integer is required
>>> print '%i' % (int(pal.data[0]))
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ValueError: invalid literal for int(): ÿ
>>> int(pal.data[0],16)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ValueError: invalid literal for int(): ÿ
>>> 

_what_ am i doing wrong here?

i can't see anything wrong for the life of me. It seems the pythonware
people use a non-standard format for hex numbers. any ideas?

-- 
Thomi Richards
thomi@imail.net.nz
http://thomi.imail.net.nz/
Thomi Richards,
thomi@imail.net.nz