[Fwd: Re: hex string to hex value]

tim tim.vets at skynet.be
Tue Nov 22 19:26:47 EST 2005


Brett g Porter wrote:

> tim wrote:
>
>>
>> I end up with 66 again, back where I started, a decimal, right?
>> I want to end up with 0x42 as being a hex value, not a string, so i 
>> can pas it as an argument to a function that needs a hex value.
>> (i am trying to replace the 0x42 in the line  
>> midi.note_off(channel=0, note=0x42) with a variable)
>
>
>
> As far as Python is concerned, 66 decimal and 42 hex are exactly the 
> same thing. There's absolutely no difference in calling
>
> note_off(0x42)
> and
>
> note_off(66)
>
> See:
>
> >>> def f(c):
> ...    print c
> ...
> >>> f(66)
> 66
> >>> f(0x42)
> 66
> >>>
>
>
>
so it was easier than I thought!
great :D
thanks for your help guys!





More information about the Python-list mailing list