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?
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?
import sys
for line in sys.stdin:
sys.stdout.write(line)
Input:
echo "Hello StackOverflow" | python3 hello.py
Output:
Hello StackOverflow