[Tutor] convert ascii to binary

Aaron Pilgrim aaronpil at gmail.com
Wed Sep 12 13:20:58 CEST 2012


Hello,
I am trying to write a small program that converts ascii to binary.

I tried using the python reference library section 18.8 but had
trouble understanding how to make it work.

 Here is the code I am currently trying to use:

def main():	
	import binascii
	myWord = input("Enter the word to convert..")	
	#convert text to ascii
	for ch in myWord:
		print(ord(ch))		
		#convert ascii to binary
		binascii.a2b_uu(ord(ch))

main()

Thank you for any help you can provide


More information about the Tutor mailing list