I'm trying to count the number of lines that start with ">" using grep and then store that value as a Python
integer object [int
]. I'm running the command with subprocess
using the call
method.
In [8]: x = subprocess.call(f"grep -c '^>' {path}", shell=True)
4626
In [9]: x
Out[9]: 0
It's going to stdout
but I want it to go into the variable x
.