Advertisement
FranzVuttke

pipe_test.py

Nov 28th, 2023 (edited)
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | Source Code | 0 0
  1.                        
  2. #!/usr/bin/python
  3. #
  4. # by OuNiS 11.2023
  5. #
  6. # https://stackoverflow.com/questions/17658512/how-to-pipe-input-to-python-line-by-line-from-linux-program
  7. #
  8. # usage:
  9. # $ echo "TEST TEXT" | pipe_test.py
  10. #
  11.  
  12. import sys
  13.  
  14. # if len(sys.argv) > 1:
  15. #     print(">> ", sys.argv[1])
  16.  
  17.  
  18. print("form Python script: ")
  19. for line in sys.stdin:
  20.     sys.stdout.write(line)
  21.     # or
  22.     # print(line)
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement