File size: 373 Bytes
51c29b8
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
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)