Ask HN: How can I add shell pipeline support to my Python program?

1 points by memorable ↗ HN
Hi there!

I am currently working a program that allows you to fetch HTML data from a file/raw HTML document input, like this:

   curl https://gohugo.io/ | soup '.title.text'
I have got the program to work as intended on its own, but now I am getting stuck at supporting the pipeline. Does anyone here have any advice or tips for implementing it?

All helps are appreciated!

4 comments

[ 2.8 ms ] story [ 22.4 ms ] thread
I've not done this before, but, in a basic test I think this seemed to work

    import sys
    print(sys.stdin.read())
Just tried it and it seems to work! Thanks for the answer!
This seems like a StackOverflow question...
Yes, I know it's a SO question, but since I can't find it elsewhere, and I can't bother to go to StackOverflow and create a new account, so now I am asking.