Linux Mint 18.3, python 3.5.2. Is something similar to this program possible?
#!/usr/bin/env python3
import subprocess
wlist = subprocess.run(['wc', '-w'],
stdin=subprocess.run(['ls'],stdout=subprocess.PIPE, universal_newlines=True),
stdout=subprocess.PIPE, universal_newlines=True).stdout
print(wlist)
This can be done with separate subprocess statements, writing to and reading from disk. If it can be done in one statement, it should use less CPU, memory, and disk I/O.