Facebook
From ExtreamChaozz, 3 Years ago, written in Python.
This paste is a reply to Re: Formatting Issue from ExtreamChaozz - go back
Embed
Viewing differences between Re: Formatting Issue and Re: Re: Formatting Issue
elif Converter_Choice2 == str(3):

            def Bin_to_Txt():
                print("\nYour Message in Binary:")
                bin_input = input("")
                binary_int = int(bin_input, 2)
                byte_number = binary_int.bit_length() + 7 // 8

                binary_array = binary_int.to_bytes(byte_number, "big")
                ascii_text = binary_array.decode()

                clear()
                print("\nYour Message in Text:")
                print(ascii_text)

            Bin_to_Txt()
            
# One of the methods i tried but didn't work.

                                                ascii_text_formatted = ("{:<15}".format(ascii_text))
                                                print(ascii_text_formatted)