📅  最后修改于: 2023-12-03 15:33:42.099000             🧑  作者: Mango
pip install quiet
- Shell-Bashpip install quiet
is a Python package which provides a simplified way to call shell/bash commands within Python scripts without producing the output on the console. This package can be used to run programs/websites/rest-apis that rely on backend shell/bash commands on the terminal.
pip install quiet
from quiet import shell
# Command
shell.run("echo 'Hello World'")
# Command with options
shell.run("ls", "-la")
# Command with a dictionary of environmental variables
env_variables = {"PATH": "/usr/local/bin"}
shell.run("echo $PATH", env=env_variables)
Apart from this, the package also provides two other functions for intermediate and advanced users:
# Get the output of the command as a string
output = shell.check_output(command)
# Get the exit code of a command
exit_code = shell.check_call(command)
Integrating a shell/bash command-line-style interface into Python scripts is made simple and fast with this package. The interface provided by quiet
enables programmers to easily implement shell/bash commands into Python code for better convenience, flexibility, and quality control.