sys.stdin.read a code example
Example 1: python read from stdin
import sys
data = sys.stdin.readlines()
Example 2: from sys import stdin
from sys import stdin
for line in stdin:
n = int(line)
if n == 42:
break
print(n)
import sys
data = sys.stdin.readlines()
from sys import stdin
for line in stdin:
n = int(line)
if n == 42:
break
print(n)