Junior — Middle
Which library is used to implement the mechanism of launching and waiting for data transfer?
sobes.tech AI
Answer from AI
In Python, the standard library subprocess is often used to implement process launching mechanisms and wait for data transfer. It allows launching new processes, interacting with them through input/output channels, and waiting for their completion.
Example of usage:
import subprocess
# Launch a command and get the output
result = subprocess.run(['ls', '-l'], capture_output=True, text=True)
print(result.stdout)
Thus, subprocess is the main library for managing processes and exchanging data with them.