[Python] A python text io stream with peek?

Discussão em 'Python' iniciado por Stack, Maio 16, 2025.

  1. Stack

    Stack Membro Participativo

    BufferedReader is great, but it isn't a text io stream and I don't want to decode UTF-8 on my own. For that I should use TextIOWrapper, but that doesn't have a peek method. In some cases I guess I could implement peek(n): result = read(n); seek(-len(result), SEEK_CUR), but without writing my own buffer or my own UTF-8 decoding, what should I do?

    Continue reading...

Compartilhe esta Página