Facebook
From ExtreamChaozz, 3 Years ago, written in Python.
This paste is a reply to Re: Formatting Issue from ExtreamChaozz - view diff
Embed
Download Paste or View Raw
Hits: 192
  1. elif Converter_Choice2 == str(3):
  2.  
  3.             def Bin_to_Txt():
  4.                 print("\nYour Message in Binary:")
  5.                 bin_input = input("")
  6.                 binary_int = int(bin_input, 2)
  7.                 byte_number = binary_int.bit_length() + 7 // 8
  8.  
  9.                 binary_array = binary_int.to_bytes(byte_number, "big")
  10.                 ascii_text = binary_array.decode()
  11.  
  12.                 clear()
  13.                 print("\nYour Message in Text:")
  14.                 print(ascii_text)
  15.  
  16.             Bin_to_Txt()
  17.            
  18. # One of the methods i tried but didn't work.
  19.  
  20.                 ascii_text_formatted = ("{:<15}".format(ascii_text))
  21.                 print(ascii_text_formatted)