Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created March 12, 2021 02:11
Show Gist options
  • Save parzibyte/ce63e3e7bbb35ca842203a91c691eb88 to your computer and use it in GitHub Desktop.
Save parzibyte/ce63e3e7bbb35ca842203a91c691eb88 to your computer and use it in GitHub Desktop.
def texto_a_binario(texto):
texto_binario = "" # El resultado
contador = 0
for letra in texto:
texto_binario += ascii_a_binario(letra)
# Agregar un espacio entre binarios, excepto si es el último carácter
if contador + 1 < len(texto):
texto_binario += separador
contador += 1
return texto_binario
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment