Implementation Of The Linux Find Command In Python
Can someone point me to a set of instructions of how to actually implement and utilize the find command within a Python script? I have looked at: https://docs.python.org/2/librar
Solution 1:
You probably want to use the check_output()
helper function.
find_output = subprocess.check_output('find ~', shell = True)
In the above example, find_output
will contain a bytes
instance of the find
commands stdout
. If you wish to capture the stderr
as well, add stderr=subprocess.STDOUT
as a keyword argument.
Post a Comment for "Implementation Of The Linux Find Command In Python"