import subprocess def execute_command(command): result = subprocess.run(command, shell=True, capture_output=True, text=True) return result.stdout, result.stderr if __name__ == "__main__": # Esempio di comando da eseguire stdout, stderr = execute_command("echo 'Hello, World!'") print("Output:", stdout) if stderr: print("Errors:", stderr)