"convert" string to bytes without changing data (encoding)

Serhiy Storchaka storchaka at gmail.com
Fri Mar 30 21:06:45 CEST 2012

28.03.12 21:13, Heiko Wundram написав(ла):
> Reading from stdin/a file gets you bytes, and
> not a string, because Python cannot automagically guess what format the
> input is in.

In Python3 reading from stdin gets you string. Use sys.stdin.buffer.raw 
for access to byte stream. And reading from file opened in text mode 
gets you string too.

More information about the Python-list mailing list