Python Programming - Standard Libraries - Discussion
Discussion Forum : Standard Libraries - General Questions (Q.No. 78)
78.
How can you use the
subprocess
module in Python to run an external command and capture its output?
Answer: Option
Explanation:
import subprocess
# Example usage of subprocess module for running an external command and capturing its output
result = subprocess.run(['ls', '-l'], capture_output=True, text=True)
print(result.stdout)
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers