import os command = "ls" #The command needs to be a string os.system(command) #The command can also be passed as a string, instead of a variable
Here is what the above code is Doing:
1. The os module is imported.
2. The command is stored in a variable.
3. The os.system() function is called with the command as the argument.
4. The command is executed.