[Tutor] Binary 2 text & text 2 binary

Joseph Quigley cpu.crazy at gmail.com
Sat Sep 24 17:28:34 CEST 2005


>From: "R. Alan Monroe" <amonroe at columbus.rr.com>
>They're easy. Just put stuff in square brackets with commas between.
>mycoollist = [1,5,9,3,6,9,2,6]
>mystringlist = ['a', 'u', 'e', 'b', 'd', 'h', 'q', 't']
Ah sorry I forgot to say: I know how to print them but that's about it.

>Can you predict what this code will do?
>print mycoollist[0]
yes. It will print (edited) [1, 2, 3 ,4 ........]
I'll rephrase myself again: I'd like to know where I can find tutorials
for slicing or some help from any of you. However keep on reading and I
think I'll have my answer :-)

>Message: 11
>Date: Sat, 24 Sep 2005 10:42:13 +0200
>From: Pujo Aji <ajikoe at gmail.com>
>If your symbol are specific it is better to use dictionary.
Good Idea! Thanks....

>then if the user give an input you can take character by character and
>translate into your binary.
>This is the code textTobinary:
> mydic = {'A' : "01000001", 'B' : "01000010", 'C' : "01000011"}
>strinput = 'ABBC'
>result = [mydic[x] for x in strinput_process]
>print result
This helps a lot, thank you!

More information about the Tutor mailing list