[Fwd: Re: hex string to hex value]

T

tim

ok, but if i do

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)
 
R

Rocco Moretti

tim said:
ok, but if i do


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)
True

There is no such thing as a "hex value"- only hex *representations* of a
value.

midi.note_off() doesn't take a "hex value", it takes an integer, and,
for whatever reason, it happens to be listed in your example in a
hexidecimal representation.
 
D

Dennis Lee Bieber

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)
There's no difference. 0x42 and 66 are TEXT REPRESENTATIONS of
integer values that are stored internally as binary. It may only become
critical if you need an exact BYTE (which would be a 1-character string
in Python)
--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top