How to Count the Number of Lines of an Output?
You can pipe the output in to wc
. You can use the -l
flag to count lines. Run the program normally and use a pipe to redirect to wc.
python Calculate.py | wc -l
Alternatively, you can redirect the output of your program to a file, say calc.out
, and run wc
on that file.
python Calculate.py > calc.out
wc -l calc.out