Skip to content

Using AREPL with input

Almenon edited this page Dec 29, 2018 · 1 revision

You can hardcode stdin in three ways:

def standard_input():
    yield 'hello'
    yield 'world'
standard_input = ["hello", "world"]
standard_input = "hello\nworld"

print(input()) # prints hello
print(input()) # prints world

# print(input()) # there is no more input - StopIteration error would be raised