import io b = io.BufferedReader(io.BytesIO(b"12")) b.read(1) b.close() b.peek()