Await lines of text from stdin or another text input stream.
Example usage: async for line in stream_as_generator(stream=sys.stdin):print(f”read {repr(line)}”)
Example usage:
async for line in stream_as_generator(stream=sys.stdin):print(f”read {repr(line)}”)
print(f”read {repr(line)}”)
stream
Stream to read, e.g. sys.stdin.
sys.stdin
str
Exit if this string is seen. Ignored if blank.
A non-empty string that is stripped of leading and trailing whitespace,
stream_as_generator()