Repeating the same question is not likely to get a better answer, just more guesses.
Kent
Tamm, Heiko wrote:
Ok, thank you.
Does anybody know how to convert a HEX into a BINARY?
Best regards
Heiko
-----Original Message-----
From: Pierre Barbier de Reuille [mailto:[EMAIL PROTECTED] Sent: Friday, February 04, 2005 2:55 PM
To: Tamm, Heiko
Subject: Re: [Tutor] Hex to Str - still an open issue
Oh ! You meant the other way around ?
If you have a string with an Hex number in it it's very easy :
a = int("F04", 16)
you can replace "16" with every base you want :)
After that, to get an octal representation :
"%o" % a
But I don't know for binary representation ... nor for any other base :( That's somthing missing I think !
Pierre
Tamm, Heiko a écrit :
Thank you, Pierre,
But I'm looking for a solution to convert a Hex number into binary, decimal, interger numbers.
E.g.:
What is the the binary value of the hex number 1F4.
Is there a function available, or how can it be done?
Kind regards and a nice weekend
Heiko
-----Original Message----- From: Pierre Barbier de Reuille [mailto:[EMAIL PROTECTED] Sent: Friday, February 04, 2005 2:35 PM To: Tamm, Heiko Cc: tutor@python.org Subject: Re: [Tutor] Hex to Str
Given you have a number in 'a' :
hex(a)
returns the hexadecimal representation of 'a' as a string ! You can also try :
"%x" % a
After that, I don't know if there is some builtin to print a number in any base you want !
Pierre
Tamm, Heiko a écrit :
Hello,
I like to know, if it's possible to convert a Hex number into String or other formats?
How can it be done?
Kind regards
Heiko
---------------------------------------------------------------------- --
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
-- Pierre Barbier de Reuille
INRA - UMR Cirad/Inra/Cnrs/Univ.MontpellierII AMAP Botanique et Bio-informatique de l'Architecture des Plantes TA40/PSII, Boulevard de la Lironde
34398 MONTPELLIER CEDEX 5, France
tel : (33) 4 67 61 65 77 fax : (33) 4 67 61 56 68
-- Pierre Barbier de Reuille
INRA - UMR Cirad/Inra/Cnrs/Univ.MontpellierII AMAP Botanique et Bio-informatique de l'Architecture des Plantes TA40/PSII, Boulevard de la Lironde 34398 MONTPELLIER CEDEX 5, France
tel : (33) 4 67 61 65 77 fax : (33) 4 67 61 56 68 _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor