### Open Source Your Knowledge, Become a Contributor

Shell commands can be executed from within Python using the function system("shell command"), which is defined in the module os. A newer alternative to os.system that provides much more flexible functionality is the call function, which is defined in the subprocess module: