Python: чтение длинных строк с помощью asyncio.StreamReader.readline() ⇐ Python
Python: чтение длинных строк с помощью asyncio.StreamReader.readline()
The asyncio version of readline() (1) allows reading a single line from a stream asynchronously. However, if it encounters a line that is longer than a limit, it will raise an exception (2). It is unclear how to resume reading after such an exception is raised.
I would like a function similar to readline(), that simply discards parts of lines that exceed the limit, and continues reading until the stream ends. Does such a method exist? If not, how to write one?
1: https://docs.python.org/3/library/async ... reamreader
2: https://github.com/python/cpython/blob/ ... ms.py#L549
Источник: https://stackoverflow.com/questions/780 ... r-readline
The asyncio version of readline() (1) allows reading a single line from a stream asynchronously. However, if it encounters a line that is longer than a limit, it will raise an exception (2). It is unclear how to resume reading after such an exception is raised.
I would like a function similar to readline(), that simply discards parts of lines that exceed the limit, and continues reading until the stream ends. Does such a method exist? If not, how to write one?
1: https://docs.python.org/3/library/async ... reamreader
2: https://github.com/python/cpython/blob/ ... ms.py#L549
Источник: https://stackoverflow.com/questions/780 ... r-readline
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Asyncio Async Funcitons вешает с Asyncio.gather. (Код работает без Asyncio.gather)
Anonymous » » в форуме Python - 0 Ответы
- 25 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Как прочитать файл JSON с помощью StreamReader на C# и пропустить недопустимые узлы
Anonymous » » в форуме C# - 0 Ответы
- 16 Просмотры
-
Последнее сообщение Anonymous
-