0

I want to make a simple application hello.py in python that prints the piped string, so that when I call

echo "Hello StackOverflow" | python3 hello.py

The python app prints

Hello StackOverflow

What do I write in my hello.py file?

1 Answers1

1
import sys

for line in sys.stdin:
    sys.stdout.write(line)

Input:

echo "Hello StackOverflow" | python3 hello.py

Output:

Hello StackOverflow
Synthase
  • 5,849
  • 2
  • 12
  • 34