Hi I'm playing with a Binary to text & text to binary converter. I can't figure out how to replace the characters (first stage: text to binary).
I thought lists would be the best but I really don't know how to use them... here's my code: #! /usr/bin/env python A = "01000001" B = "01000010" C = "01000011" D = "01000100" E = "01000101" F = "01000110" G = "01000111" H = "01001000" I = "01001001" J = "01001010" K = "01001011" L = "01001100" M = "01001101" N = "01001110" O = "01001111" P = "01010000" Q = "01010001" R = "01010010" S = "01010011" T = "01010100" U = "01010101" V = "01010110" W = "01010111" X = "01011000" Y = "01011001" Z = "01011010" # Symbols exclamationPoint = "0010 0001" hash = "0010 0011" dollar = "001 0100" percent = "0010 0101" _and = "0010 0110" parentheses = "0010 1000" closeParentheses = "0010 1001" comma = "0010 1100" dash = "0010 1101" period = "0010 1110" underline = "0101 1111" # Numbers zero = "00110000" one = "00110001" two = "00110010" three = "00110011" four = "00110100" five = "00110101" six = "00110110" seven = "00110111" eight = "00111000" nine = "00111001" ltra = "a" ltrb = "b" ltrc = "c" while True: text = raw_input("Enter text: ") text = list(text) Thanks, Joe _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor