Created
July 17, 2018 12:54
-
-
Save Fhernd/6a78a4d42199925bfbd7fa39b2d079a8 to your computer and use it in GitHub Desktop.
Escribir bytes en una flujo de solo texto. 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
import sys | |
# Está línea produce el error TypeErro: | |
# a razón de que se está tratando de | |
# escribir una cadena de bytes en la salida estándar: | |
#sys.stdout.write(b'Python!\n') | |
# Se debe utilizar el objeto buffer para | |
# lograr la escritura de bytes en una flujo | |
# de solo texto: | |
print(sys.stdout.buffer.write(b'Python!\n')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment