Feb-04-2020, 02:31 PM
Hi all,
super new to python and working on a text to binary convertor using a dictionary, and wanting to understand how I get back to text after I have the binary output.
I currently have this;
Any help would be great,
thanks,
G
super new to python and working on a text to binary convertor using a dictionary, and wanting to understand how I get back to text after I have the binary output.
I currently have this;
def to_text_code(text): code = {'a':'01100001','b':'01100010','c':'01100011} text_code = "" for x in text: text_code += code[x.lower()] return text_code text = input("Text to Binary Converter: ") print(to_text_code(text))It seems to work for the letters that I have placed in my dictionary and I can have multiple entries. However, when reversing the dictionary to go from binary back to text I'm having lots of issues.
Any help would be great,
thanks,
G