[Tutor] ASCII hex to binary

Alan Trautman ATrautman@perryjudds.com
Mon Aug 4 12:51:02 EDT 2003


Jimmy,

You have a two part problem. I'll try to include a description the step
needed to make a program that will work.
The first problem is splitting this long string into separate values
(parsing into discrete values in gobbledy gook).

The left function will allow you to grab the left most character which needs
to be looked at.

Ok confused?

Do you need the binary values for the sum or for each individual number? 

If its just the total grab each value convert it into its decimal equivalent
and add them together. Then just convert it to binary.

If separate values are needed I would put each position into a into a
dictionary probably with a decimal value. 

Then write a function that converts each to a binary value putting it back
in the dictionary. 

save the data as needed.

http://scholar.hw.ac.uk/site/computing/topic7.asp?outline=no

Has a nice description on how to convert to binary from decimal if that is
needed.

HTH,

Alan


Hello *

Can some please tell me how can i express an ASCII hexadecimal string in the

binary form with python.

10BF31704FAB5B1F03F9B68B1F39A66521B1841F1481697F8E12B7F7DDD6E3D7248D965B1CD4
5E2114

I want this string to be expressed in binary form.

Thanks in advance.

waiting for reply.

Regards

_________________________________________________________________
It's raining movies. Bollywood is flooded. 
http://server1.msn.co.in/features/augustmovies03/index.asp August has 
arrived!


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor




More information about the Tutor mailing list