Created
July 4, 2018 11:34
-
-
Save Fhernd/8b65b5ca74509bb764e0c83ba6856195 to your computer and use it in GitHub Desktop.
Manipulación de cadenas de caracteres con representaciones textuales y binarias. OrtizOL.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from io import StringIO, BytesIO | |
# StringIO diseñada para la manipulación de texto: | |
cadena = StringIO() | |
cadena.write('¡Python es génial!\n') | |
print('Python is awesome!', file=cadena) | |
print(cadena.getvalue()) | |
# BytesIO diseñada para trabajar a nivel de bytes: | |
cadena = BytesIO() | |
cadena.write(b'Python es un lenguaje muy expresivo.') | |
print(cadena.getvalue()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment