2

I'm trying to use the call method within python, how do I pipe something in (l | grep c++)?

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Thomas Smith
  • 23
  • 1
  • 6

1 Answers1

3

Based on Python subprocess command with pipe

s = subprocess.Popen(["l"], stdout=subprocess.PIPE)
output = subprocess.check_output(("grep", "c++"), stdin=s.stdout)
Community
  • 1
  • 1
Nolen Royalty
  • 18,415
  • 4
  • 40
  • 50