2

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

OneCricketeer
  • 151,199
  • 17
  • 111
  • 216

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
  • 17,717
  • 4
  • 38
  • 48