How to read the original data line by line from stdin in python 3 just like python 2?

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Jan 29 00:55:59 EST 2020


On 29/01/20 6:27 pm, Peng Yu wrote:
> Suppose that I use this to read from stdin. But `line` contains
> decoded data in python 3. In python 2, it contains the original data.
> What is the best way to get the original data in python 3?

Read from stdin.buffer, which is a stream of bytes.

-- 
Greg


More information about the Python-list mailing list