[Fwd: Re: hex string to hex value]
Rocco Moretti
roccomoretti at hotpop.com
Tue Nov 22 19:10:20 EST 2005
More information about the Python-list mailing list
Tue Nov 22 19:10:20 EST 2005
- Previous message (by thread): [Fwd: Re: hex string to hex value]
- Next message (by thread): [Fwd: Re: hex string to hex value]
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
tim wrote: > ok, but if i do > > >>> n=66 > >>> m=hex(n) > >>> m > '0x42' > >>> h=int(m,16) > >>> h > 66 > >>> > > 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) >>> note = 0x42 >>> print note 66 >>> note is 66 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.
- Previous message (by thread): [Fwd: Re: hex string to hex value]
- Next message (by thread): [Fwd: Re: hex string to hex value]
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list