[Tutor] More confusion on conversion

Vicki Stanfield vicki at thepenguin.org
Fri Oct 31 09:29:11 EST 2003


I'm about ready to go batty (wasn't intended as a Halloween pun, but I'll
take it). I am so close with the following code:

hexlength = '02X' % length
print hexlength
for each in hexlength:
     port.write(each)
     time.sleep(.01)

but it generates an error:

hexlength = '02X' % length
TypeError: not all arguments converted

I print the length, and it is 10. That is 2 characters, right? Or is it 3
with the terminator? If I set hexlength to '0A', it does what I want, but
unfortunately, it is a variable.

--vicki



More information about the Tutor mailing list