First page Back Continue Last page Overview Graphics

Usage of the standard streams

>>> import sys

>>> print("Going via stdout")

Going via stdout

>>> sys.stdout.write("Another way to do it!\n")

Another way to do it!

22

>>> x = input("read value via stdin: ")

read value via stdin: 42

>>> print(x)

42

>>> sys.stdin.readline()[:-1]

42

'42'